jQueryinsertafter()
不能在$(this)
变量中工作。
我的编码在这里
<select name="input_field[]" class="selectcase">
<option value="">Select</option>
<option value="input">Text</option>
<option value="option">Option</option>
</select>
脚本
$(this).change(function (){
$("<div><input type='text' name=''></div>").insertAfter($(this));
});
我有很多选择标签,然后选择特定的选择标签。使用更改功能,我想在选择标记后添加文本框。我用过insertAfter()
功能。但这是行不通的。
不要this
在第一行中将其用作ID,必须将其替换为select
:
$('select').change(function (){
$("<div><input type='text' name=''></div>").insertAfter($(this));
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句