我需要将按键事件绑定到动态构建的元素形式,见下文
<div class="Customer">
<select name="dropdown1" id="dropdown1">
</select>
<input type="textbox" name="firstname1" id="firstname1">
<input type="textbox" name="lastname1" id="lastname1">
</div>
<div class="Customer">
<select name="dropdown2" id="dropdown2">
</select>
<input type="textbox" name="firstname2" id="firstname2">
<input type="textbox" name="lastname2" id="lastname2">
</div>
... and repeat..
我需要检查,只要上述任何元素发生更改,其他元素都不会为空。
表单中还有其他几个元素,尽管我只关心代码段中突出显示的这些元素。
非常感谢,
我试过下面的代码
$('.Customer').each(function (index) {
alert("test"); // alerts the correct number of customer rows
$("input:textbox").click(function() {
alert("");
})
});
解决方案应该适用于 jQuery 1.3.2