Using a plugin that calls a .jsp that uses its own stylesheet hosted externally (it's a yelp embed - trying to manipulate the look of it). The one element I'm trying to change has an !important tag on it, and I can't seem to change it...
I tried
<script type="text/javascript">
$('.elementToChange').css({'background-color':'black'});
</script>
to no avail. Ideas?
Via regular expression: https://jsfiddle.net/7jj7gq3y/2/
HTML:
JavaScript:
It looks like in more up-to-date versions of jQuery (at least 1.7.2 and higher) you can simply set the css:
See http://jsfiddle.net/HmXXc/185/
In older versions of jQuery and Zepto you had to clear the css first:
And then reset it using:
Or in a one-liner:
See http://jsfiddle.net/HmXXc/186/.
Original answer:
Note: this may be a bad idea, as it will remove any other inline styles
I would edit the style attribute directly
http://jsfiddle.net/RichardTowers/3wemT/1/
You can use the following function:
Execute as follows:
You can manipulate !important css by using following steps, either you can use inline-css or Internal css or you can load your own external css after the order of that preloaded css, it will help you to override that css with your custom one.
Here is your solution:
http://jsfiddle.net/irpm/bdhpp/2/
The idea is to add the class: