Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. $(document).ready(function() {
  2. $('#selecctall').click(function() { //on click
  3. if(this.checked) { // check select status
  4. $('.checkbox1').each(function() { //loop through each checkbox
  5. this.checked = true; //select all checkboxes with class "checkbox1"
  6. });
  7. }else{
  8. $('.checkbox1').each(function() { //loop through each checkbox
  9. this.checked = false; //deselect all checkboxes with class "checkbox1"
  10. });
  11. }
  12. });
  13.  
  14. });
  15.  
  16. <ul class="chk-container">
  17. <li><input type="checkbox" id="selecctall"/> Selecct All</li>
  18. <li><input class="checkbox1" type="checkbox" name="check[]" value="item1"> This is Item 1</li>
  19. <li><input class="checkbox1" type="checkbox" name="check[]" value="item2"> This is Item 2</li>
  20. <li><input class="checkbox1" type="checkbox" name="check[]" value="item3"> This is Item 3</li>
  21. <li><input class="checkbox1" type="checkbox" name="check[]" value="item4"> This is Item 4</li>
  22. </ul>
  23.  
  24. $('#selecctall').click(function() {
  25.  
  26. $('#selecctall').click(function(event) {
  27.  
  28. $('#selecctall').click(function(foo) {
  29.  
  30. $('#selecctall').click(function(foo, bar, baz, bing) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement