*****************************JS********************************************
$(document).ready(function() {
$('#selecctall').click(function(event) { //on click
if(this.checked) { // check select status
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
});
**********************html********************************************
Check/Uncheck All
<input type="checkbox" name="cat[]" id="selectall">
Architecture and Design <input class="checkbox1" type="checkbox" name="cat[]" value="1">
Builders/Contractors <input class="checkbox1" type="checkbox" name="cat[]" value="2">
Building Material <input class="checkbox1" type="checkbox" name="cat[]" value="3">
Construction Equipments <input class="checkbox1" type="checkbox" name="cat[]" value="4">
Doors and Windows <input class="checkbox1" type="checkbox" name="cat[]" value="5">
Flooring and Furnishes <input class="checkbox1" type="checkbox" name="cat[]" value="7">
Green Technology <input class="checkbox1" type="checkbox" name="cat[]" value="8">
Mechanical & Electrical <input class="checkbox1" type="checkbox" name="cat[]" value="9">
Safety Equipment <input class="checkbox1" type="checkbox" name="cat[]" value="10">
$(document).ready(function() {
$('#selecctall').click(function(event) { //on click
if(this.checked) { // check select status
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
});
**********************html********************************************
Check/Uncheck All
<input type="checkbox" name="cat[]" id="selectall">
Architecture and Design <input class="checkbox1" type="checkbox" name="cat[]" value="1">
Builders/Contractors <input class="checkbox1" type="checkbox" name="cat[]" value="2">
Building Material <input class="checkbox1" type="checkbox" name="cat[]" value="3">
Construction Equipments <input class="checkbox1" type="checkbox" name="cat[]" value="4">
Doors and Windows <input class="checkbox1" type="checkbox" name="cat[]" value="5">
Flooring and Furnishes <input class="checkbox1" type="checkbox" name="cat[]" value="7">
Green Technology <input class="checkbox1" type="checkbox" name="cat[]" value="8">
Mechanical & Electrical <input class="checkbox1" type="checkbox" name="cat[]" value="9">
Safety Equipment <input class="checkbox1" type="checkbox" name="cat[]" value="10">
No comments:
Post a Comment