+ 3
Use CSS on text created by JavaScript
Can you style text created by JavaScript with CSS?
2 Answers
+ 3
like this.
elem = document.getElementById(elemId);
elem.style.background = 'white';
+ 3
Text created by JS as text node elements, are necessarly put in another existing element on the page, so they inherit from styles of their parents, and you can dynamically change attributes and/or css properties as you want ^^