Guest User

Untitled

a guest
May 22nd, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. Change label css of checked checkbox
  2. $("#CheckBoxList1").click(function() {
  3. $(this).find('label').removeClass('red');
  4. if ($('span').hasClass('checked'))
  5. $(this).find('label').addClass('red');
  6. });
  7.  
  8. <table id="CheckBoxList1" border="0">
  9. <tbody>
  10. <tr>
  11. <td>
  12. <div class="checker" id="uniform-CheckBoxList1_0">
  13. <span>
  14. <input id="CheckBoxList1_0" type="checkbox" name="CheckBoxList1$0" style="opacity: 0; "/>
  15. </span>
  16. </div>
  17. <label for="CheckBoxList1_0">Mark Park</label>
  18. </td>
  19. <td>
  20. <div class="checker" id="uniform-CheckBoxList1_1">
  21. <span>
  22. <input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" style="opacity: 0; "/>
  23. </span>
  24. </div>
  25. <label for="CheckBoxList1_1">Amy Lee</label>
  26. </td>
  27. <td/>
  28. </tr>
  29. </tbody>
  30. </table>
  31.  
  32. $("#CheckBoxList1").click(function() {
  33. $(this).find('label').removeClass('red');
  34. $('span.checked').parent().next('label').addClass('red');
  35. });
  36.  
  37. $(".check").click(function() {
  38. var id = $(this).attr("id").split("_");
  39. //access array of id
  40. $(".label_"+id[1]).addClass("red");
  41. }
  42.  
  43. <input id="CheckBoxList1_0" id="check_1" type="checkbox" class="check" name="CheckBoxList1$0" style="opacity: 0; "/>
  44.  
  45. <label for="CheckBoxList1_0" id="label_1">Mark Park</label>
  46.  
  47. $("label[for='comedyclubs']").toggleClass("red");
Advertisement
Add Comment
Please, Sign In to add comment