how to know checkbox is checked in jquery
how to know checkbox is checked in javascript, Here we are provide a example similar to that
code for this example :
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
function selectcheckbox(x){
var cls = $(x).attr('class');
if($('.'+cls).attr('checked')){
alert('chek box is checked');
}
else { alert('check box is unchecked');}
}
</script>
<form action="" method="">
<input type="checkbox" name="checkboxname" value="checkboxvalue" class="checkboxcls" onclick="selectcheckbox(this)"/> Select Check box
</form>
code for this example :
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
function selectcheckbox(x){
var cls = $(x).attr('class');
if($('.'+cls).attr('checked')){
alert('chek box is checked');
}
else { alert('check box is unchecked');}
}
</script>
<form action="" method="">
<input type="checkbox" name="checkboxname" value="checkboxvalue" class="checkboxcls" onclick="selectcheckbox(this)"/> Select Check box
</form>
Comments
Post a Comment
If you Satisfied , Please Leave a comment