Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get text from select tag in javascript

<select id="box1" onChange="myNewFunction(this);">
  <option value="98">dog</option>
  <option value="7122">cat</option>
  <option value="142">bird</option>
</select>
<script>
  function myNewFunction(sel) {
  alert(sel.options[sel.selectedIndex].text);
}
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #text #select #tag #javascript
ADD COMMENT
Topic
Name
1+8 =