Selected index with multiple select

W

Wim Roffal

In a normal select I can see with selectedIndex which option is selected.

However, I was wondering how I can see the same thing in a multiple select
where more than one option is selected.

Kind regards,
Wim
 
J

Janwillem Borleffs

Wim Roffal said:
In a normal select I can see with selectedIndex which option is selected.

However, I was wondering how I can see the same thing in a multiple select
where more than one option is selected.

This is done by checking if the item's selected property is set to true:

for (var i = 0; i < obj.length; i++) {
if (obj.selected) {
// Item has been selected
}
}


JW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top