0

I know it's possible to modify an element's style attribute using JavaScript, but is it possible to modify the global CSS rule itself? Take the following example:

$('div.test').css('display', 'none');

That modifies all pre-existing elements matching:

<div class="test"></div>

If this script were executed while a page was half loaded the DOM tree would not be complete and any matching elements not loaded wouldn't have this styling rule applied. Is there a way to modify the actual div.test rule itself using JavaScript?

By the way, I do have my own solution to this and am not asking for any workarounds. I would just like to know if this in particular is possible since I've never seen it done before.

ne1410s
  • 6,864
  • 6
  • 55
  • 61
Bryan Way
  • 1,903
  • 3
  • 17
  • 27

0 Answers0