test
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • johannesdach Friend
    #184935

    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?

    HeR0 Friend
    #483612

    Hi Johannesdach
    Plz go to http://api.jquery.com/bind/
    Try with

    jQuery( '.jrCheckboxLabel input:checkbox' ).on( 'click', function () {
    jQuery(".jrCheckboxLabel").toggleClass('highlight');
    });

    Hope this help.

    Regards

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 2 replies, has 2 voices, and was last updated by  HeR0 11 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum