Javascript: how to document.print option value in Select block?

Posted by HH on Stack Overflow See other posts from Stack Overflow or by HH
Published on 2010-12-22T01:50:18Z Indexed on 2010/12/22 1:53 UTC
Read the original article Hit count: 436

Filed under:
|

The below returns [object HTMLOptionElement] while I try to return the value.

  document.write(document.getElementById("allSelect").options[0]).value;

by value, I mean the thing called value there (there is a form around it but not relevant now):

<select name="allSelect" id="allSelect" size=3>
<option value="1"selected">1</option>  
<option value="2">2</option>  
<option value="3">3</option>
</select>

How can I return the value of an option?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about select