Sean wrote:
> Oh, I just tried it and actually you're right! Bummer. It worked in
> the code I was using, anyway ;-)
>
> That behavior actually doesn't make much sense to me; it doesn't seem
> like, in practive, you'd ever have immediate siblings that could be
> some class (or whatever) that yo
Oh, I just tried it and actually you're right! Bummer. It worked in
the code I was using, anyway ;-)
That behavior actually doesn't make much sense to me; it doesn't seem
like, in practive, you'd ever have immediate siblings that could be
some class (or whatever) that you don't expect. Selecti
Hi Sean,
Actually, you can't use .next() in that situation.
The argument for .next() acts as a filter for what the very next
sibling can be. So, jQuery(this).next('#someId) will only select the
very next sibling, and only if it has an id of "someId"
cf. http://docs.jquery.com/Traversing/ne
Actually, since next() takes a selector as an argument, you can use next().
Just do something like the following:
jQuery("div.faq h4").click(function() {
jQuery(this).next("#WhateverClass").addClass("top");
});
Sean
Karl Swedberg-2 wrote:
>
> The .next() method will only select the very n
The .next() method will only select the very next sibling. If you
have other siblings in between the two h4s, you'll need to use a
different selector.
You could try this instead:
jQuery('div.faq h4').click(function() {
jQuery('~ h4:first', this).addClass('top');
});
That'll find the first
Next() will only get siblings -- can you post the html?
-- Josh
- Original Message -
From: "ruperdupe" <[EMAIL PROTECTED]>
To: "jQuery (English)"
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 headin
6 matches
Mail list logo