In this post Asp.Net jQuery checkbox get checked
state, we shall see on how to get the checked state of a checkbox using jQuery.
We can get the checked state of a checkbox using any
one of the 3 syntaxes specified bellow.
alert($('#chkStatus').attr('checked')
? true : false);
alert($('#chkStatus:checked').val() ? true : false);
alert($('#chkStatus:checked').is(':checked'));
To set the checked status, on click of a button uses the following script.
To set the checked status, on click of a button uses the following script.
// Get Status of CheckBox
$('#cmdGetCheckedStatus').click(function(event) {
event.preventDefault();
alert($('#chkStatus:checked').is(':checked'));
});
To see a
full example using jQuery and Checkbox refer to the post Asp.Net jQuery checkbox Tutorial.
Related Posts
No comments:
Post a Comment