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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With