Select / Deselect all checkboxes using jQuery

Today, We want to share with you Select / Deselect all checkboxes using jQuery.In this post we will show you select all checkbox jquery datatable, hear for jquery uncheck all checkboxes except current one we will give you demo and example for implement.In this post, we will learn about jquery uncheck all checkboxes with same name with an example.

Select / Deselect all checkboxes using jQuery

There are the Following The simple About jquery uncheck all checkboxes with same name Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to uncheck select all checkbox when one checkbox is unchecked, so the some major files and Directory structures for this example is following below.

Step 1: Include jQuery library

At first we need to include jQuery Latest library file.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

Step 2: JavaScript/jQuery Source Code:

This file All the Data contains the following JavaScript/jQuery Source codes.

$(document).ready(function(){
$('#check_all_checkbox').on('click',function(){
if(this.checked){
$('.checkbox').each(function(){
this.checked = true;
});
}else{
$('.checkbox').each(function(){
this.checked = false;
});
}
});

$('.checkbox').on('click',function(){
if($('.checkbox:checked').length == $('.checkbox').length){
$('#check_all_checkbox').prop('checked',true);
}else{
$('#check_all_checkbox').prop('checked',false);
}
});
});

Step 3: HTML Source Code:

This file contains the following HTML Markup Source codes.

<div class="col-sm-8">
<h2></h2>
<h5></h5>
<ul class="main" style="list-style-type: none;">
 	<li><input id="check_all_checkbox" type="checkbox" /> Select all
<ul style="list-style-type: none;">
 	<li><input class="checkbox" type="checkbox" value="1" />Item 1</li>
 	<li><input class="checkbox" type="checkbox" value="2" />Item 2</li>
 	<li><input class="checkbox" type="checkbox" value="3" />Item 3</li>
 	<li><input class="checkbox" type="checkbox" value="4" />Item 4</li>
 	<li><input class="checkbox" type="checkbox" value="5" />Item 5</li>
</ul>
</li>
</ul>
 

</div>

Step 4: CSS Source Code

Following CSS Source codes are used for Multiple Checkbox Select/Deselect using jQuery.

.main{
height: 200px;
background: #aaa;
}

Web Programming Tutorials Example with Demo

Read :

Summary

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

I hope you get an idea about uncheck all checkboxes jquery in div & select all checkbox jquery datatable.
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.