Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Change label css of checked checkbox
- $("#CheckBoxList1").click(function() {
- $(this).find('label').removeClass('red');
- if ($('span').hasClass('checked'))
- $(this).find('label').addClass('red');
- });
- <table id="CheckBoxList1" border="0">
- <tbody>
- <tr>
- <td>
- <div class="checker" id="uniform-CheckBoxList1_0">
- <span>
- <input id="CheckBoxList1_0" type="checkbox" name="CheckBoxList1$0" style="opacity: 0; "/>
- </span>
- </div>
- <label for="CheckBoxList1_0">Mark Park</label>
- </td>
- <td>
- <div class="checker" id="uniform-CheckBoxList1_1">
- <span>
- <input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" style="opacity: 0; "/>
- </span>
- </div>
- <label for="CheckBoxList1_1">Amy Lee</label>
- </td>
- <td/>
- </tr>
- </tbody>
- </table>
- $("#CheckBoxList1").click(function() {
- $(this).find('label').removeClass('red');
- $('span.checked').parent().next('label').addClass('red');
- });
- $(".check").click(function() {
- var id = $(this).attr("id").split("_");
- //access array of id
- $(".label_"+id[1]).addClass("red");
- }
- <input id="CheckBoxList1_0" id="check_1" type="checkbox" class="check" name="CheckBoxList1$0" style="opacity: 0; "/>
- <label for="CheckBoxList1_0" id="label_1">Mark Park</label>
- $("label[for='comedyclubs']").toggleClass("red");
Advertisement
Add Comment
Please, Sign In to add comment