<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<input type="checkbox" class="chkbox_select_all_class" id="select_all">Select All <br>
<input type="checkbox" class="chkbox_class">One <br>
<input type="checkbox" class="chkbox_class">Two <br>
<input type="checkbox" class="chkbox_class">Three <br>
<input type="checkbox" class="chkbox_class">Four <br>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$("#select_all").click(function()
{
if(this.checked)
{
$(".chkbox_class").prop('checked',true);
}
else
{
$(".chkbox_class").prop('checked',false);
}
});
$('.chkbox_class').change(function()
{
if(this.checked==false)
{
$("#select_all").prop('checked',false);
}
else
{
if($(".chkbox_class:checked").length==$(".chkbox_class").length)
{
$("#select_all").prop('checked',true);
}
}
});
</script>