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.

Read Also:  jquery uncheck all checkboxes Multiple Checkbox Example

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.

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:  tellraw generator minecraft bedrock - Command List

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.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Laravel 6 Display Message box
  2. Read Also:  Select / Deselect all checkboxes using jQuery
  3. Read Also:  PHP Laravel Paths Example Tutorial From Scratch
  4. Read Also:  Angular 6 Image Upload with Validation Example
  5. Read Also:  Select All checkboxes using jQuery
  6. Read Also:  AngularJS Get Current Date Time Example
  7. Read Also:  javascript concatenate string and variable
  8. Read Also:  jQuery Check Uncheck All Checkbox Examples
  9. Read Also:  PHP Whatsapp Rest API Send and Recieve WhatsApp Message
  10. Read Also:  Simple PHP Convert Date Format Examples