Tuesday 7 August 2012

Check Uncheck List

Script for Check and Uncheck list of check box. just click on header check box all check box automatically checked.

<form action="" method="post" name="frmBrand">
<input type="checkbox" id="master" onClick="check_unChack_All(frmBrand)">

<input type="checkbox" name="brand_id" id="brand_id" value="123">
<input type="checkbox" name="brand_id" id="brand_id" value="123">
<input type="checkbox" name="brand_id" id="brand_id" value="123">

</form>

<script>

function check_unChack_All(field){
var act=true;
if(document.getElementById('master').checked==true){
act=true;
}else{ act=false;}
for (i = 0; i < field.length; i++){
field[i].checked = act ;
}
}
</script>


No comments:

Post a Comment