value (select, option element)

Jump to: navigation, search

Applies to  ?


This example sets the value for each option element to a supply stock number.

function fnShowText(){
   /* Use the selectedIndex property of the SELECT control
   to retrieve the text from the options collection. */
   var sText = "Stock Number = " + oSel.options(oSel.selectedIndex).value;
<SELECT ID="oSel" onchange = "fnShowText()">
<OPTION VALUE="STK#45">Item One - Basketball</OPTION>
<OPTION VALUE="STK#347">Item Two - Baseball</OPTION>
<OPTION VALUE="STK#67">Item Three - Hockey Puck</OPTION>



Individual control objects return a value to the server only if they have been selected by the user. You may pass server-friendly data directly to the server without confusing the user. The user sees only the innerText displayed, and not the value.


Standards information

See also

Related articles


… further results"html" is not in the list of possible values (Canvas, CSS Font, CSS Layout, Animation, Audio, Background, Border, Box Model, CSS Attributes, CSSOM, Combinators, Deprecated, Document Structure, Exclusions, FileSystemAPI, Filters, Flexbox, Fonts, Generated and Replaced Content, Gradients, Grid Layout, HTML, Multimedia, Media Queries, Mobile, Multi-Column, Off-line Storage, Paged Media, Performance, Pointer Events, Pseudo-Classes, Pseudo-Elements, Regions, Responsive Web Design, Ruby, Scrollbar, Selectors, Security, Shapes, Syntax, Tables, Text, Touch, Transforms, Transitions, Video, Visual Effects, Web Components, WebRTC, XHR) for this property.

Related pages (MSDN)

  • option
  • select


This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]