Check Uncheck All Checkboxes using jQuery Selectors

Today, We want to share with you Check Uncheck All Checkboxes using jQuery Selectors.In this post we will show you Select / Deselect All CheckBoxes using jQuery, hear for how to uncheck select all checkbox when one checkbox is unchecked, we will give you demo and example for implement.In this post, we will learn about How do I check/uncheck all checkboxes with a button using jQuery? with an example.

Check Uncheck All Checkboxes using jQuery Selectors

There are the Following The simple About jquery select all checkboxes in table Full Information With Example and source code.

As I will cover this Post with live Working example to develop uncheck all checkbox jquery by class name, so the jquery uncheck all checkboxes with same name is used for this example is following below.

Read Also:  SQL Inner, Left, Right and Full Joins

Check Uncheck All Checkboxes Using Jquery

$(“:checkbox”) selector is used to select all the check boxes in the web page. and then we set the Selected attribute as true or false to perform the Select Deselect All operation.You will need to include jQuery library in the header or footer of the website.
index.html


<script type="text/javascript" profile="javascript" src=" http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
	</script>
<script>
         $(document).ready(function() {
             // select All
             $('.selectAll').click(function() {
                 $(":checkbox").attr("checked", true);
             });
             // deselect All
             $('.deselectAll').click(function() {
                 $(":checkbox").attr("checked", false);
             });
         });
      </script>
<a class="selectAll" href="#"> select All</a> <a class="deselectAll" href="#"> Uncheck All</a>

<input type="checkbox" />Mobile
<input type="checkbox" />i10
Lenova
<input type="checkbox" />Laptop
<input type="checkbox" />Dasktop
<input type="checkbox" />Home

Example : Check and uncheck all checkboxes with jquery

Form with Checkbox Group

<div id="divCheckAll"><input id="checkall" name="checkall" type="checkbox" />Check All</div>
<div id="divCheckboxList">
<div class="liveSelectprofile"><input id="profile1" name="profile" type="checkbox" value="Virat" />Virat</div>
<div class="liveSelectprofile"><input id="profile2" name="profile" type="checkbox" value="Fhoni" />Fhoni</div>
<div class="liveSelectprofile"><input id="profile3" name="profile" type="checkbox" value="Modiji" />Modiji</div>
<div class="liveSelectprofile"><input id="profile4" name="profile" type="checkbox" value="Astha" />Astha</div>
</div>

jQuery Script to Check or Uncheck

function check_uncheck_checkbox(isChecked) {
if(isChecked) {
$('input[name="profile"]').each(function() {
this.checked = true;
});
} else {
$('input[name="profile"]').each(function() {
this.checked = false;
});
}
}

Web Programming Tutorials Example with Demo

Read :

Read Also:  JavaScript Preview Image before Upload with jQuery

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Check and Uncheck all checkbox using jQuery Example.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.