How to checked all checkbox by on click on one checkbox via jquery?

How to checked all checkbox by on click on one checkbox via jquery?

download jquery file from http://jquery.com/ and save into your folder.
Note: Do not give online path of on your file otherwise this code will not work,  download jquery file form server and save it in your folder
Now simple copy and paste this code in your file



<script src="yourSiteUrl/js/jquery.min.js"></script> // Change this yourSiteUrl from your site url
<script>
function markall() {
var AllDay = $("#select_all").is(":checked") ? "true" : "false";
    if(AllDay=='true')
    {
        $('.clsNoborder').attr('checked',true);
    } else {
        $('.clsNoborder').attr('checked',false);
    }
};
</script>
<div>
<input type="checkbox" id="select_all" name="select_all" onclick="markall();"/>: check all
</div>
<div>
 <input type="checkbox" class="clsNoborder" name="Bizzlist[]" id="Bizzlist[]" value="1"  /><br/>
<input type="checkbox" class="clsNoborder" name="Bizzlist[]" id="Bizzlist[]" value="2"  /></br>
<input type="checkbox" class="clsNoborder" name="Bizzlist[]" id="Bizzlist[]" value="3"  /></br>
</div>

Thanks for visit this Blog

Comments