So I have a gridview with a checkbox field. In jquery, I’d like to write a function that does something when an unchecked checkbox is checked.
function clickAllSize() {
alert("helloy");
}
$(document).ready(function () {
$("input :checkbox:not(checked)").change(clickAllSize());
});
The problem is that the function is running immediately on pageload, before any clicking. Subsequent checking/unchecking does not trigger the alert.
This should it:
Jquery is designed to work with 0+ selected elements, so always when you debug JQuery code check what is the selector length: