176
rated 0 times
[
180]
[
4]
/ answers: 1 / hits: 16029
/ 11 Years ago, mon, october 21, 2013, 12:00:00
boxes checked using jQuery prop()
do not affect listeners attached to change
handler.
My code is something like
HTML
<div>
<label>
<input type=checkbox class=ch />test</label>
<label>
<input type=checkbox class=ch />test</label>
<label>
<input type=checkbox class=ch />test</label>
<input type=button value=check the box id=select />
</div>
JS
$(body).on(change, .ch, function(){
alert(checked);
});
$(body).on(click, #select, function(){
$(this).parent(div).find(input[type=checkbox]).prop(checked, true);
});
the alert fires when I click on the checkbox. How can I make it fire when the property of the checkbox changes? JSBIN
More From » jquery