Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

select tag event listener

// directly pass selected value to function in onchange!
function myFunction(chosen) {
  console.log(chosen);
}

<select onChange="myFunction(this.options[this.selectedIndex].value)">
  <option value="1">Text 1</option>
  <option value="2">Text 2</option>
</select>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #select #tag #event #listener
ADD COMMENT
Topic
Name
7+4 =