How to trigger checkbox click event even if it's checked through Javascript code?
You can use the jQuery .trigger()
method. See http://api.jquery.com/trigger/
E.g.:
$('#foo').trigger('click');
Getting check status
var checked = $("#selectall").is(":checked");
Then for setting
$("input:checkbox").attr("checked",checked);
You can use .change()
function too
E.g.:
$('form input[type=checkbox]').change(function() { console.log('hello') });