if(prev_clicked) { $("#accordion li a.category").css('background-image', 'url("img/off_all_channel.png")'); $("#accordion li a.comment").css('background-image', 'url("img/on_all_online.png")'); $(".icha0").removeProperty("background-color"); $(".icha0").removeProperty("opacity"); } else { $(".icha0").css("background-color","#D5D5D2"); $(".icha0").css("opacity","0.70"); }
I am trying to remove two css properties that I added but It seems not working. Any though?
2 different approaches to remove style inline CSS in jQuery. Use removeAttr() to remove all inline style attribute. Use CSS() to remove the specific CSS property.
To remove all CSS classes of an element, we use removeClass() method. The removeClass() method is used to remove one or more class names from the selected element.
The . removeProp() method removes properties set by the . prop() method. Note:This method should not be used to remove built-in (native) properties such as "checked", "disabled", "selected", or others.
Use the style. removeProperty() method to remove CSS style properties from an element, e.g. box. style. removeProperty('background-color') .
You can remove them by:
$(".icha0").css({ 'background-color' : '', 'opacity' : '' });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With