Jump to content

jQuery :eq on selection menu?


piearcy

Recommended Posts

Quick question that I have not been able to find on the internet. Go figure. 

 

Can you apply the jQuery :eq(index) to a selection menu? I use it for list items but have been unsuccessful at using it for a selection menu. Probably because they aren't an ordered list? 

 

So I've probably answered my own question there. 

 

What could I use in it's place for a selection menu? 

 

I'm indexing the actual line item referenced to know what to load thusly...

$('.tab-content div.tab:eq(' + $('#tab-menu > li').index(this) + ')').slideDown('slow');

Really need to do the same thing with a selection menu but google has not helped me out so far. 

 

 

Link to comment
Share on other sites

Have you tried this?

$('.tab-content div.tab').eq($('#tab-menu > li').index(this)).slideDown('slow');

Apparently you'll also get a performance boost (http://api.jquery.com/eq-selector/).

Yeah. Tried that. Gave up and decided to write longer code but it works. Just made a series of if else statements to determine with selection was selected and then do it's thing. I have no patience. Going to be slower but it is what it is I suppose. 

 

The problem with the above is it doesn't select the correct item. Always chooses the last one. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.