Skip to content Skip to sidebar Skip to footer

Checked Changing Opacity Of Another Element Using Js

I'm trying to make images' (on my webpage) opacity change when different accordions are expanded (input:checked). This is the site in question: http://oasisexpressautowash.com/pack

Solution 1:

jQuery().checked() is not a valid event handler. You should use the jQuery.click() or jQuery.change() event instead.

Inside the change event, you should check if the element is checked and then take appropriate action.

jQuery(".chbd-ac-container input:nth-child(1)").click(function() {
    if (this.checked) {
        $('img.top').css({
            opacity: 0
        });
    } else {
        $('img.top').css({
            opacity: 1.0
        });
    }
});

Post a Comment for "Checked Changing Opacity Of Another Element Using Js"