Question moved from Stack Overflow since it's apparently offtopic there.
It appears people misunderstand the request. I'm perfectly aware that jqueryjQuery has css()
method which allows me to modify the style specified elements. However I want to modify rules within a stylesheet on the go. It has some legit uses which the css()
method cannot replace.
Something like:
<style id="dyn-style">
p{ color:black; }
</style>
<p>TEST</p>
<script>
$('#dyn-style').getCssRule('p').alterRule('color', 'red');
</script>
Which then changes the contentscontent of the stylestyle
element to this:
<style id="dyn-style">
p{ color:red; }
</style>
I searched a bit, but only found this solution. From what I understand, it only adds new stylestyle
elements (with defined styles) rather than alter existing ones.
I'm tempted to write a plugin ofon my own, but it would be pointless to do so if one exists already.