Select and Deselect CheckBox using jquery

Demo For Select All and DeSelect All Check Boxes
Selecct All
This is Item 1
This is Item 2
This is Item 3
This is Item 4
This is Item 5
This is Item 6
Do not select this











<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(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"                    
            });      
        }
    });
 
});
</script>
<table class="">
<tr><td><input type="checkbox" id="selecctall"/> Selecct All</td></tr>
<tr><td><input class="checkbox1" type="checkbox" name="check[]" value="item1"> This is Item 1</td></tr>
<tr><td><input class="checkbox1" type="checkbox" name="check[]" value="item2"> This is Item 2</td></tr>
<tr><td><input class="checkbox1" type="checkbox" name="check[]" value="item3"> This is Item 3</td></tr>
<tr><td><input class="checkbox1" type="checkbox" name="check[]" value="item4"> This is Item 4</td></tr>
<tr><td><input class="checkbox1" type="checkbox" name="check[]" value="item5"> This is Item 5</td></tr>
<tr><td><input class="checkbox1" type="checkbox" name="check[]" value="item6"> This is Item 6</td></tr>
<tr><td><input class="checkbox2" type="checkbox" name="check[]" value="item6"> Do not select this</td></tr>
</table>

No comments:

Post a Comment

using avrdude with AVR studio(for windows 10 only)

Requirements 1. arduino-1.6.5-r2-windows.exe 2. as6installer-6.0.1843.exe When I try to configure avrdude in avr studio 6 then wina...