Title pretty much sums it up.
The external style sheet has the following code:
td.EvenRow a{
display: none !important;
}
I have tried using:
element.style.display = "inline";
and
element.style.display = "inline !important";
but neither works. Is it possible to override an !important style using javascript.
This is for a greasemonkey extension, if that makes a difference.
Building on @Premasagar's excellent answer; if you don't want to remove all the other inline styles use this
Can't use
removeProperty()
because it wont remove!important
rules in Chrome.Can't use
element.style[property] = ''
because it only accepts camelCase in FireFox.You can use:
https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/setProperty
https://jsfiddle.net/xk6Ut/256/
One option to override CSS class in JavaScript is using an ID for the style element so that we can update the CSS class
..
Rather than injecting style, if you inject a class(for eg: 'show') through java script, it will work. But here you need css like below. the added class css rule should be below your original rule.
I believe the only way to do this it to add the style as a new CSS declaration with the '!important' suffix. The easiest way to do this is to append a new <style> element to the head of document:
The rules added with the above method will (if you use the !important suffix) override other previously set styling. If you're not using the suffix then make sure to take concepts like 'specificity' into account.
https://developer.mozilla.org/en-US/docs/Web/CSS/initial
use initial property in css3