+ 4

How can use hover in JavaScript?

i wanna say while using style like that (a.style.color="red") how can i add hover in JavaScript file please help.๐Ÿ˜Š๐Ÿ˜Š

23rd Apr 2018, 9:29 PM
Hozan Anwar
Hozan Anwar - avatar
8 Answers
+ 21
helloo
24th Apr 2018, 1:35 AM
Nina Hendra Putri
Nina Hendra Putri - avatar
+ 4
It's called onmouseover event
23rd Apr 2018, 9:38 PM
Toni Isotalo
Toni Isotalo - avatar
+ 3
You need to use onmouseleave event to get the default styling back
23rd Apr 2018, 9:45 PM
Toni Isotalo
Toni Isotalo - avatar
+ 3
Well, if you just want to add a different color when hovering a link, just use the :hover selector to your CSS: a:hover { color: red; } Javascript on hover event is used to fire events, such as <a href=โ€œjavascript:void(null);โ€ onmouseover=โ€œjavascript:myFunction();โ€>Hover me</a> But itโ€™s used mainly in different elements, such as divs, tr, etc..
23rd Apr 2018, 9:47 PM
Luigi
Luigi - avatar
+ 1
๐Ÿ‘๐Ÿ‘๐Ÿ‘ Luigi thanks alot pal.
23rd Apr 2018, 9:49 PM
Hozan Anwar
Hozan Anwar - avatar
+ 1
No problem! ๐Ÿ‘
23rd Apr 2018, 10:47 PM
Luigi
Luigi - avatar
0
thanks alot Toni Isotalo i will try to do it.โ˜บ
23rd Apr 2018, 9:44 PM
Hozan Anwar
Hozan Anwar - avatar
24th Apr 2018, 8:04 AM
Hozan Anwar
Hozan Anwar - avatar