+ 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