我在这个WordPress页面上有一个联系表格7。 http://globaldonorsforum.org/register/
在注册人数下拉列表中更改时,我会根据输入的人数生成输入字段。
但该页面后面没有向下滚动。
我使用自定义JS在Contact Form 7中处理此功能。
$('#cf7-container-builder-1522388635110 select').on('change', function() {
$('.appendInputs').remove();
var limit = $('#cf7-container-builder-5594975 input').val();
var val = parseInt(limit , 10);
if (limit != '') {
for (var i = 1; i < val+1 ; i++) {
$('#cf7-container-builder-1522405628622').before('<div class="appendInputs cf7-builder-container-row1 cf7-builder-container-row-inner cf7-main-builder dropped ui-sortable-handle" id="cf7-container-builder-1522405628622'+i+'"><div class="cf7-ctrl"><div class="cf7-move"></div><div class="cf7-colunm"></div><div class="cf7-dub cf7-dub-row"></div><div class="cf7-remove"></div></div><div class="cf7-row"><div class="col-md-12"><div class="cf7-builder-container-row-inner-drop ui-droppable ui-sortable"><div class="cf7-text cf7-main-builder dropped cf7_input_icon ui-sortable-handle" id="cf7-container-builder-1522407137043"><div class="cf7-ctrl cf7-ctrl-inner"><div class="cf7-move"></div><div class="cf7-edit"></div><div class="cf7-dub cf7-dub-text"></div><div class="cf7-remove"></div></div><div class="cf7_text_label">Additional Registrant '+i+'</div><div class="cf7_font"><i class="fa fa-user-plus" aria-hidden="true"></i></div><div class="cf7_text_shortcode"><span class="wpcf7-form-control-wrap addRegistrant'+i+'"><input type="text" name="addRegistrant'+i+'" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false"></span></div></div></div></div></div></div></div>');
}
}
if ($('#cf7-container-builder-1522388635110 select').val() == 750){
$('.appendInputs').remove();
}
});
我相信这是因为在追加数据之后会混淆滚动和HTML /身高。但我无法弄明白。有什么帮助吗?