This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes JQuery to Iterate Over Select List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JQuery to Iterate Over Select List" Watch "JQuery to Iterate Over Select List" New topic
Author

JQuery to Iterate Over Select List

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1394
For what ever reason the following will only return a value if an element is selected and then only that element.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

That's an id selector, so there can be only one element with that id. So why bother iterating over it?

If you have more than one element with the same id, that's not valid HTML and whatever happens is non-deterministic.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1394
Bear Bibeault wrote:That's an id selector, so there can be only one element with that id. So why bother iterating over it?

If you have more than one element with the same id, that's not valid HTML and whatever happens is non-deterministic.


I did not have the selector set up right. I had to add 'options' to it and it worked.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

If you have more than one element with the same id, it's guaranteed to stop working at the most inopportune time. Be sure that there is only one element with a unique id value.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JQuery to Iterate Over Select List
 
Similar Threads
select a value from a drop down menu bar in a HTML page
how to open xml file into html page
how to order a combo box with numbers in it
Multiple Selection boxes of same width
alert() is changing script function