Check and Uncheck checkboxes using JQuery
In this post we will give you information about Check and Uncheck checkboxes using JQuery. Hear we will give you detail about Check and Uncheck checkboxes using JQueryAnd how to use it also give you demo for it if it is necessary.
Sometimes we need to Select and Deselect all checkboxes like you see on gmail if you check top checkbox then automatically select other all.So, we can do using jquery and its method prop().In Following example you can see how is that and use this example simply:
Example:
<html lang="en">
<head>
<title>Select and Deselect Checkbox</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<input name="subject_all" type="checkbox">Select All<br/>
<input value="1" name="subject" type="checkbox">Subject 1
<input value="2" name="subject" type="checkbox">Subject 2
<input value="3" name="subject" type="checkbox">Subject 3
<input value="4" name="subject" type="checkbox">Subject 4
<input value="5" name="subject" type="checkbox">Subject 5
<script type="text/javascript">
$('.subject-all').on('change', function() {
if(this.checked){
$('.subject-list').prop('checked', true);
}else{
$('.subject-list').prop('checked', false);
}
});
</script>
</body>
</html>
Hope this code and post will helped you for implement Check and Uncheck checkboxes using JQuery. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs