I am trying to: use jQuery to add a class to checkbox labels when the checkbox input is in a state of :checked
I visited this URL:
I expected to see: the class added to the label
Instead, I got: the class added for a brief moment and then removed after the search content is updated
I'm using this jQuery to add a class to the parent label of checkbox inputs in the parametric checkboxes because the label is wrapping the input instead of being a sibling to it (inconvenient markup in my opinion). Anyway, the class gets added for a brief moment and then gets overwritten by something ( the search results are set to be updated when any value is updated ).
Here's the jQuery:
jQuery(document).on("change","input[type=checkbox]",function () {
jQuery(this).parent().toggleClass("chked");
});
I'm not sure what I need to do. I'm trying to add the class so I can style the checkbox display instead of using the ugly default browser checkboxes. But for some reason it's not sticking.
Thanks in advance for your help.
I spent the last hour trying to get this to work and just figured it out after submitting the ticket.