Next() will only get siblings -- can you post the html?

-- Josh

----- Original Message ----- From: "ruperdupe" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Thursday, August 30, 2007 11:36 AM
Subject: [jQuery] next() problems



What I'm trying to do is when someone clicks on a h4 heading the next
one has a class (top) added to it. In between each heading there are
other elements. The h4s are inside a div called 'faq'.

So far I've tried:

jQuery('div.faq h4').click(function() {
jQuery(this).next().addClass('top');
});

And:

jQuery('div.faq h4').click(function() {
jQuery(this).next('h4').addClass('top');
});

Neither works and I can't figure out why? If anyone could help, that
would be great!

(I'm using jQuery instead of $ because I'm using Prototype as well)

Reply via email to