I have a series of divs that share a class for various reasons (and several divs that are created using code at other points).
I tried to find the answers, but everyone relies on a class that is in the stylesheet (if there is one), which does not happen in this case or that it modifies existing elements instead of existing rules.
So I need to do something like ...
var add_to_styles('myClassName');
myClassName.cssText = "color: red;"
And all created divs (both before and after the script) that have a class
<div class="myClassName">I should be red</div>
Exit with rule change. But I did not find anything like it.
source
share