javascript to get value of dropdown
var e = document.getElementById("selectElementID");
var value=e.selectElement.options[e.selectedIndex].value;// get selected option value
var text=e.options[e.selectedIndex].text;//get the selected option textvar e = document.getElementById("elementId");
var value = e.options[e.selectedIndex].value;
var text = e.options[e.selectedIndex].text;// reference to 'scripts' select list
// used throughout the examples below
var sel = document.getElementById('scripts');
// display value property of select list (from selected option)
console.log( sel.value );
Also in JavaScript:
- empty array js
- create json model online
- how to access any argument in javascript
- js replace blogger thumb
- url redirect javascript
- scroll to top
- vue get height of element ref
- mongoose populate filter
- jest input value
- js check if array
- js tan-1
- update node mac to specific version
- js loop through associative array
- Converting circular structure to JSON
- resize js
- tilt js vue
- remove a value to an array of javascript
- node js interview questions
- how to delete an element of an array in javascript
- jquery remove br from div
- get latest file from s3 bucket javascript
- Property 'find' does not exist on type NodeListOf
- jest
- javascript append to paragraph