Hey guys,
I am trying to change the color of a checkbox label, depending on whether the checkbox is checked or not. The div looks like this
<div class="jrFieldOption">
<label class="jrCheckboxLabel">
<input id="jr_tags_civil-society" class="jr_tags" type="checkbox" value="civil-society" name="data[Field][Listing][jr_tags][]">civil society
</label>
</div>
I have added a jquery script in ja_mendozite/js and called it in the theme layout file in the backend. testing it with
jQuery(document).ready(function(){
jQuery(".jrCheckboxLabel").toggleClass('highlight');
});
works fine. However it doesn’t work if I put in the checkbox click event. Than it doesn’t produce any results, although this works fine in a jsfiddle.
jQuery( '.jrCheckboxLabel' ).on( 'click', 'input:checkbox', function () {
jQuery(".jrCheckboxLabel").toggleClass('highlight');
});
I tested this with two different components (jomsocial and reviews) which leads me to the template itself.
Do you have an idea?