piearcy Posted February 24, 2015 Share Posted February 24, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/294866-jquery-eq-on-selection-menu/ Share on other sites More sharing options...
maxxd Posted February 24, 2015 Share Posted February 24, 2015 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/). Quote Link to comment https://forums.phpfreaks.com/topic/294866-jquery-eq-on-selection-menu/#findComment-1506609 Share on other sites More sharing options...
piearcy Posted February 24, 2015 Author Share Posted February 24, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/294866-jquery-eq-on-selection-menu/#findComment-1506610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.