On Sep 8, 2006, at 9:41 AM, Mark Harwood wrote:

> At the moment i am using the following
>
>         $(document).ready(function(){
>                 $("#navBar li a").click(function(){
>                     $(".subNav").SlideToggleDown(500);
>                 });
>             });
>
> Now my issuse is that the above will of course effect each .subNav
> element, but i wish only to affect any child elements of "#navBar  
> li a"

I guess this depends on how your HTML is structured. Is ".subNav"  
really a child of your "a"? I don't think it's valid markup to put,  
for example, an unordered list inside an "a" element.

If, on the other hand, you're doing something like this...

   <ul id="navBar">
     <li><a href="#" title="list item 1">list item 1</a>
         <ul class="subNav">
             <li>subnav 1</li>
         </ul>
     </li>
     <li><a href="#" title="list item 2">list item 2</a>
       <ul class="subNav">
             <li>subnav 2</li>
       </ul>
     </li>
   </ul>

... then you could select the appropriate  .subNav like this:

   $(this).next('subNav').SlideToggleDown(500);


Hope that helps. If not, please send a snippet of the markup.

Karl
___________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to