I'm tring to use JQuery to automatically sum inputs in a table where rows are added dynamically. $().delegate and $().live do not seem to work if the selector contains an input with a name with [ ]. The same selector works with bind.
Here is a sample code :
<div id="area">
<input name="x[]"/>
<input name="x[]"/>
<input name="x[]"/>
<input name="x[]"/>
</div>
$("#area").delegate("input[name='x\\[\\]']", 'cha开发者_如何转开发nge', function () {
console.log($(this).val());
});
Any suggestions on how to fix this ?
Sample code
Worked for me using this : http://jsbin.com/eyoro3/3/edit
$("#area").delegate("input[name='x\[\]']", 'change', function () {
console.log($(this).val());
});
精彩评论