得到这个HTML:
<div id="mother">
<select id="sel" name="sel">
<option value="1">Un</option>
<option value="2">Deux</option>
<option value="3">Trois</option>
</select>
<input id="in" name="in"/>
</div>
mother是在页面中,但都是孩子,并且select是input动态生成的
尝试使用以下方式调用它们:
$('body').on('blur change','#mother input, #mother select',function(){
alert($(this).attr('id'))
})
Javascript什么都不说。。
如何最好地使用on()而不是live()?...因为有了live()它更容易弄清楚。
谢谢。