isaac_cm Posted January 31, 2007 Share Posted January 31, 2007 I wonder if there is a way to get the index of a specific value in the select tag without using for loop is there a ready to use method to get the index thanks Quote Link to comment Share on other sites More sharing options...
obsidian Posted January 31, 2007 Share Posted January 31, 2007 If you simply know the value of the option you're after, you must iterate through the options until you find a matching value, thus finding the index of it as well. If there is a function you can nab out there that finds the index for you, I can guarantee it uses iterations as well. Quote Link to comment Share on other sites More sharing options...
isaac_cm Posted January 31, 2007 Author Share Posted January 31, 2007 ok I will use for then thanks alot Quote Link to comment Share on other sites More sharing options...
bibby Posted February 1, 2007 Share Posted February 1, 2007 Edit... I read your question backwards. Sorry. Anyway, here's a function to make that loop easier. function selectedValue(selBox) { return selBox.options[selBox.selectedIndex].value; } Quote Link to comment 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.