Short answer: you can't.
Long answer: you shouldn't.
Give it a class name or an id and use stylesheets to apply the style.
:hover is a pseudo-selector and, for CSS, only has meaning within the style sheet. There isn't any inline-style equivalent (as it isn't defining the selection criteria).
Response to the OP's comments:
Also, don't forget, you can add links to external stylesheets if that's an option. For example,
var link = document.createElement("link");
var head = document.getElementsByTagName("head");
Caution: the above assumes there is a head section.
- answered 2 years ago
- Sandy Hook