Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $('#selecctall').click(function() { //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"
- });
- }
- });
- });
- <ul class="chk-container">
- <li><input type="checkbox" id="selecctall"/> Selecct All</li>
- <li><input class="checkbox1" type="checkbox" name="check[]" value="item1"> This is Item 1</li>
- <li><input class="checkbox1" type="checkbox" name="check[]" value="item2"> This is Item 2</li>
- <li><input class="checkbox1" type="checkbox" name="check[]" value="item3"> This is Item 3</li>
- <li><input class="checkbox1" type="checkbox" name="check[]" value="item4"> This is Item 4</li>
- </ul>
- $('#selecctall').click(function() {
- $('#selecctall').click(function(event) {
- $('#selecctall').click(function(foo) {
- $('#selecctall').click(function(foo, bar, baz, bing) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement