Hi,

I'm trying to loop through a listbox that is runat="server" (to get all the values of the items inside the listbox regarless of if they are selected or not).

Now i have searched for hours on end and still don't find anything (all the examples is just for the selected items....). Can someone please guide me to the correct way of doing this. O, i want to do it with jQuery preferably.

-------------------
phoenix_dwarf

Recommended Answers

All 4 Replies

loop through a listbox

var oLB = getElementById("boxname")
            for (var i = 0; i < oLB.options.length; i++) {
                 ... process oLB.options[i].value ...
            }
var oLB = getElementById("boxname")
            for (var i = 0; i < oLB.options.length; i++) {
                 ... process oLB.options[i].value ...
            }

Thnx but already tried that and then i get this error: "Microsoft JScript runtime error: 'options.length' is null or not an object"...

Any thoughts??

Any thoughts??

Without code to examine? No.

My apologies. It is working now, the only problem was that i tried using jQuery instead of getElementByID...

Thanx again

--------
aQuila

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.