checkbox label style updating then reverting
I have a script which is supposed to be adding a class when a checkbox in a checkboxlist is checked and removing it when the checkbox is not selected. When I click a checkbox the style IS added BUT it immediately changes right back. Here is the script.
- $(document).ready(function () {
- $("#cbxarea input[type=checkbox]").click(function () {
- if ($(this).is(":checked")) {
- $(this).siblings("label").addClass("checkboxselected");
- } else {
- $(this).siblings("label").removeClass("checkboxselected");
- }
- });
- });