<select> <option> an element in DOM ?

Discussion in 'ASP .Net Web Controls' started by John Grandy, May 11, 2007.

  1. John Grandy

    John Grandy Guest

    For an html <select> control , does the browser store each <option> as a
    separate element in the DOM tree ?

    Or are the select options stored in some other manner ?
     
    John Grandy, May 11, 2007
    #1
    1. Advertising

  2. John Grandy

    Teemu Keiski Guest

    Something like

    <select name="sample" id="sample">
    <option value="1">The first</option>
    <option value="2">The Second</option>
    <option value="3">The Third</option>
    </select>
    <script type="text/javascript">
    function showOptions()
    {
    var ddl=document.getElementById('sample');
    for(i=0;i<ddl.options.length;i++)
    {


    alert('Text:' + ddl.options.text + ',value:' +
    ddl.options.value);
    }
    }
    </script>
    <input type="button" onclick="showOptions()" value="Show options"
    />

    should show you the idea


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    "John Grandy" <johnagrandy-at-gmail-dot-com> wrote in message
    news:...
    > For an html <select> control , does the browser store each <option> as a
    > separate element in the DOM tree ?
    >
    > Or are the select options stored in some other manner ?
    >
     
    Teemu Keiski, May 11, 2007
    #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. J. Hall
    Replies:
    2
    Views:
    1,089
    Jeff Thies
    Apr 21, 2004
  2. Robert Oschler
    Replies:
    1
    Views:
    129
    Robert Oschler
    Sep 3, 2005
  3. WebRaster
    Replies:
    1
    Views:
    279
    Francisco Spaeth
    Oct 26, 2005
  4. Nick Spacek

    Removing select option removes entire select

    Nick Spacek, Jun 21, 2006, in forum: Javascript
    Replies:
    1
    Views:
    154
    Matt Kruse
    Jun 21, 2006
  5. Manish  Tomar

    Select option change using DOM

    Manish Tomar, Apr 16, 2007, in forum: Javascript
    Replies:
    2
    Views:
    109
    Manish Tomar
    Apr 17, 2007
Loading...

Share This Page