Applying CSS in JavaScript indirectly -


when write real css do

.blue { color: blue; } 

and if added class "blue" element after loading, turn blue.

in javascript have like

var blue = document.getelementsbyclassname('blue'); (var = 0; < blue.length; i++)      blue[i].style.setproperty('color', 'blue'); 

the problem javascript version if did

document.getelementbyid('someid').classname += " blue"; 

it have class blue, not turn blue. there way (preferably simple) add style selector rather directly elements selector?

see this question. can add <style> element via javascript.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -