Jessica
Jessica

Reputation: 449

jQuery toggle one div with same class

Here is a fiddle for my hover event.

Currently on hover all divs of the same class are toggled. I'm wanting to toggle just the one div (that which is being hovered on). I've tried a few filters but can't seem to work it out.

Help would be much appreciated.

Upvotes: 0

Views: 1152

Answers (1)

moonwave99
moonwave99

Reputation: 22820

You need to search for a .foo2 in the same .container of the link:

$(".container a").hover(function()
{
    $('.foo2', $(this).parent()).toggle();
});​

Upvotes: 5

Related Questions