How to select mouse dependent object using jQuery?

I have a list of dynamically generated div tags with class attribute but no id.

How to choose the one that hangs with the mouse cursor? In CSS, it will be like this: div.classname: hover

Oh, and I would not want to use any additional jQuery plugins.

+3
source share
1 answer
$('div.classname').hover(
    function mouseover() { /* do something */}, 
    function mouseout()  { /* do other thing */}
);

EDIT: Thank you, Mika!

+13
source

Source: https://habr.com/ru/post/1698227/


All Articles