Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

value attribute | value property

Sets or retrieves the value which is returned to the server when the form control is submitted.

HTML 4.01 Specification, Section 17.6.1

Syntax

HTML<element value="p" ... >
JavaScript

p = object.value

Property values

Type: String

the value of a control object which is passed as a name/value pair to the server, when an object is submitted.

Standards information

Remarks

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.

Examples

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



<script type="text/javascript">
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;
   console.log(sText);
}
</script>
<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>
</select> 


See also

option
select

 

 

Show:
© 2014 Microsoft