<select> <option> an element in DOM ?

J

John Grandy

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 ?
 
T

Teemu Keiski

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
 

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,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top