How to code this Javascript event. mouseenter or mouseover? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to code this Javascript event. mouseenter or mouseover?

I want to make js function wich displays hidden block in it target parent block on hover. But im not sure wich event will fire it up corectly. Suppose there are same blocks - with same classes on which I want this event to run.

23rd Mar 2018, 2:23 PM
Andrew Zhukevych
Andrew Zhukevych - avatar
4 Answers
+ 5
You will call a event on the target $("#target").mouseover(function() { var parent = $(this).parent(); parent.children(".hidden").show(); )}; Because they have same classes you could use :first-children or add an id to it
23rd Mar 2018, 2:41 PM
Toni Isotalo
Toni Isotalo - avatar
+ 3
Your case is easily solved by pure css: .parent:hover .child { display: block; } And this way is preferable.
27th Mar 2018, 5:15 PM
Sxo Lreatimne
Sxo Lreatimne - avatar
0
Thank a lot man, already solved 😁
23rd Mar 2018, 11:13 PM
Andrew Zhukevych
Andrew Zhukevych - avatar
0
I will try that !
27th Mar 2018, 7:28 PM
Andrew Zhukevych
Andrew Zhukevych - avatar