views:

686

answers:

1

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

How do I select the one which is hovered with mouse cursor? In CSS it would be like this: div.classname:hover

Oh, and I wouldn't like to use any extra Jquery-plugins.

+12  A: 
$('div.classname').hover(
    function mouseover() { /* do something */}, 
    function mouseout()  { /* do other thing */}
);

EDIT: Thanks, Micah!

Jimmy
Don't forget to show how to select by class: $('.myDivClassname').hover()
micahwittman
And the object can be selected with $(this). Thanks!
Frank Bannister