DEV Community

Add Dynamic Styling to HTML Elements With JavaScript

John Au-Yeung on January 16, 2020

Subscribe to my email list now at http://jauyeung.net/subscribe/ Follow me on Twitter at https://twitter.com/AuMayeung Many more articles at http...
Collapse
 
peterthompsonnz profile image
Peter Thompson

Reminds me of when JS was used inline in 'the old days' to swap images on mouse over. If my memory serves me correctly the code was something like this:

<IMG SRC="cat1.jpg" onmouseover="JavaScript:this.src='cat2.jpg' onmouseout='javascript:this.src='cat1.jpg'>
Collapse
 
aumayeung profile image
John Au-Yeung

That looks right. It's the most basic introduction. I'm sure most people would use libraries and frameworks to make their lives easier.