I found many questions around this topic, but none is satisfying.
If you do:
$("#myCheckBox").attr("checked", "checked")
It does change the attribute and check the checkbox, but it doesn’t trigger the “change” event. Doesn’t look clean.
Or you could do:
$("#myCheckbox")[0].checked = true
But this is not beautiful.
What do you think ?
The proper way is
$('#myCheckbox').prop('checked', true);and you can then fire whatever events on it.Since 1.6: http://api.jquery.com/prop/