I've got an <input type="checkbox" id="check1" />.
How to catch change event for this checkbox if it was changed from script i.e. $('#check1').attr('checked', 'checked');?
Thanks.
Javascript doesn't fire events based on programmatic changes to form elements - to prevent infinite loops of events - so you have two (less-than-ideal) options:
This might be what you were looking for.
$(document).ready(function(){
$('#check1').click(function(){
var n = $("#check1:checked").length;
alert(n);
});
});