I have a small pickle. I can't figure out how to turn the css off after it gets activated. If the user changes their mind, I want the yellow to turn off if they deselect the button (variation). I can't figure this out.
$( ".variations_form" ).on( "woocommerce_variation_select_change", function () {
$(".ivpa_clicked").css("background-color", "yellow")
} );
$( ".single_variation_wrap" ).on( "show_variation", function ( event, variation ) {
// Fired when the user selects all the required dropdowns / attributes
// and a final variation is selected / shown
$(".ivpa_clicked").css("background-color", "green")
} );
here's the page I'm working with: https://testusers.newisw.com/product/girls-blazer/
Side Note: I tried this too, but no luck turning it off:
jQuery(document).ready(function( $ ){
$ ( "form.variations_form" ).on( "woocommerce_variation_select_change", function () {
if ($(".ivpa_clicked").css("background-color", "yellow"));
else if
($ (".ivpa_clicked").css("background-color", "transparent !important"));
}
);
});
what am I doing wrong?