Got this 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>
The mother
is in the page but both children, select
and input
are dynamically generated
Tried to call them by using something like:
$('body').on('blur change','#mother input, #mother select',function(){
alert($(this).attr('id'))
})
Javascript
is saying nothing all..
How can this be best done using on()
instead of live()
? ... because with live()
it was kinda easier to figure out.
Thanks.
.live() is deprecated and removed, don't use it at all version deprecated: 1.7, removed: 1.9
use on like this
$('body').on('blur change', '#mother input, #mother select', function () {
alert($(this).attr('id'));
});