Selected index with multiple select

Discussion in 'Javascript' started by Wim Roffal, Dec 20, 2003.

  1. Wim Roffal

    Wim Roffal Guest

    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
     
    Wim Roffal, Dec 20, 2003
    #1
    1. Advertising

  2. "Wim Roffal" <> schreef in bericht
    news:bs1kjm$dv4$...
    > 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
     
    Janwillem Borleffs, Dec 20, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mldardy
    Replies:
    0
    Views:
    980
    mldardy
    Sep 28, 2010
  2. palmiere
    Replies:
    1
    Views:
    432
    Erwin Moller
    Feb 9, 2004
  3. Ferd Berfel
    Replies:
    4
    Views:
    158
  4. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    324
    Tomasz Chmielewski
    Mar 4, 2008
  5. Max
    Replies:
    5
    Views:
    252
    Thomas 'PointedEars' Lahn
    Apr 14, 2008
Loading...

Share This Page