Link to home
Start Free TrialLog in
Avatar of smacca
smaccaFlag for Australia

asked on

JQuery - Get next fieldset item from DOM

How do I get from any of the links in the ul list to the fieldset after the list.

e.g.


 $("#a.advancedLink").click(function()
{

   //$(this).next("fieldset").toggle(); //this does not traverse the following fieldset

});


At moment, the link will simply turn off/on the form fieldset.

<div class="searchFilterBy">
    <ul>
        
        <li><a class="searchLink" href="#">Search</a></li>
        <li><a class="filterLink" href="#">Filter By</a></li>
        <li><a class="advancedLink" href="#">Advanced Search</a></li>
    
    </ul>
    <fieldset>

Open in new window

SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smacca

ASKER

Still doesn't work - is the 'get(0)' necessary??
Is there any way you can alert() the content of the tag you have grabbed - this would help with testing and debugging as I could see what I am getting with each command.

Thanks for your time.
I'm pretty sure the get(0) is necessary.

The jQuery Documentation is a useful reference: http://docs.jquery.com/Main_Page

For testing, you can do this:
$("#a.advancedLink").click(function()
{
 
   alert($(this).parent('ul').get(0).html());
}

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial