views:

100

answers:

1

Typically, for styles that have to be applied dynamically to HTML objects with JS, we set it as an attribute using "setAttribute()"

What about this "outline" CSS property? How can I set that onto an object with JS? Unless there is a way to dynamically add CSS to the document?

+7  A: 

You can change most CSS values using the following code:

document.getElementById('idofelement').style.outline='value';

or

object.style.cssproperty='value';

Here is what W3 has to say about it.

Sam152
Oh its a value of the "style" attribute! ... style="outline:none;"
Jenko
I guess that would be the HTML equivalent, yeah.
Sam152