Frage

I am completely puzzled. I have been trying to figure this thing out forever. I am the trying to change the color of the label when the user clicks the checkbox. The code below works fine in the fiddle but won't work on the website. I call the google api right before the . Is there anything else that could be causing that? Something I should lookout for?

HTML

<div class="product_checkbox_div">
<input type="checkbox" name="1" id="check1" value=""/>
<label class="product_ingredients_list">Yes</label>
</div>

CSS

.product_checkbox_div{padding-top:0.5%;padding-bottom:0.5%;vertical-align:top;}
.product_ingredients_list{font-family:Calibri;font-size: 1em;color: #101010;font-weight:     normal;vertical-align:top;}
.product_ingredients_list_1{font-family:Calibri;font-size: 1.15em;color: #f33;font-weight: normal;vertical-align:top;}

JAVASCRIPT

$( '.product_checkbox_div' ).on( 'click', 'input:checkbox', function () {
$( this ).next('label').toggleClass( 'product_ingredients_list_1', this.checked );
});

Fiddle

Thanks

War es hilfreich?

Lösung

Here you go.......

http://jsfiddle.net/aqRrz/

$("document").ready(function () {

    $("input#check1").click(function () {

        if ($(this).is(':checked')) {

            $(this).next('label').addClass('product_ingredients_list_1');

        } else {

            $(this).next('label').removeClass('product_ingredients_list_1');

        }

    })

});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top