In this post Asp.Net jQuery loop through
CheckBoxes in CheckBoxList,
we shall see on how to loop through all the checkboxes in a CheckBoxList and
get the list of values checked.
We can loop through all the checkboxes in the CheckBoxList
by filtering the type checkbox in as follows
$('#chkListCity input:checkbox').each(function() {
alert($(this).attr('id') +
' => ' + $(this).is(':checked'));
});
To loop through all the checkboxes in the page on the
click event of a button use the following script.
// Loop through all Checkboxes in a CheckBoxList
$('#cmdLoopList').click(function(event)
{
event.preventDefault();
$('#chkListCity
input:checkbox').each(function() {
alert($(this).attr('id') + ' => '
+ $(this).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