Accordion Menu a:not(:first)

I have a simple accordion menu (5 menu items in total), where only the second menu Item has a sub menu. So I need a way to target the first, third, fourth and fifth menu items to make them work direct links going straight to another page.

So far I have this:


	$(document).ready(function () {
		$( "dd" ).hide();
		$( "dt a:not(:first)" ).click(function(){
		
			$( "dd:visible" ).slideUp( "slow" );
			$( this ).parent().next().slideDown( "slow" );
			return false;
		});
	});

Where because of $( “dt a:not( :first )” ).click(function(){ the first menu item is reacting as a normal link, but I have no Idea how to target the third, forth and fifth as well. Please advise

Thank you in advance

Hi all. I tried to add extra functions like:


$( "dt a:not(:third)" ).click(function(){
});

I don’t get any errors but it isn’t working either. I not even know if third is valid to use. I’ve been searchin on Google but couldn’t find anything back. Please advise where to look for?

Thank you again

It looks like the accordion stuff is in your click listener, and you’re trying to only apply it to the second link. Is that correct? If so, you only need to use the eq function to do what you want:


$('dt a').eq(1).click(function () {
    /* do accordion stuff here */
});

Hi sdleihssirhc, does that mean I can leave this:


$( "dt a:not(:first)" ).click(function(){ 

out all together?y?

Thank you in advance.

It certainly does… I think. I’m pretty sure. Does it break if you take it out (and put it my replacement)?

Hi sdleihssirhc

That works like a charm. Thank you so much.