Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

html get selected option javascript

<select id="ddlViewBy">
  <option value="1">test1</option>
  <option value="2" selected="selected">test2</option>
  <option value="3">test3</option>
</select>

<script>
    var e = document.getElementById("ddlViewBy");
	var strUser = e.value; // 2
	var strUser = e.options[e.selectedIndex].text; //test2
</script>
Comment

js get selected option element

var yourSelect = document.getElementById( "your-select-id" );
alert( yourSelect.options[ yourSelect.selectedIndex ].value )
Comment

get selection value javascript

var e = document.getElementById("ddlViewBy");
var strUser = e.value;
Comment

get selected option from select javascript

const selectedValue = document.getElementById("color-id").value;
Comment

PREVIOUS NEXT
Code Example
Javascript :: string to date js 
Javascript :: how to get all the voice channels in discord js 
Javascript :: javascript pre increment and post increment 
Javascript :: jquery parent 
Javascript :: normalize javascript 
Javascript :: js get day name from date 
Javascript :: javascript code to calculate compound interest 
Javascript :: kendo treeview get selected node data 
Javascript :: node sass version react 
Javascript :: for loop string array javascript 
Javascript :: simple alert program in javascript 
Javascript :: javascript date to string format dd mmm yyyy 
Javascript :: Moment.js: Date between dates 
Javascript :: useReducer 
Javascript :: what is JSON TREE 
Javascript :: how to insert html into javascript 
Javascript :: javascript regex Zero or one occurrence 
Javascript :: Return the average of the given array rounded down to its nearest integer. 
Javascript :: js typeof number 
Javascript :: how to send axios delete to the backend reactjs 
Javascript :: discord.js start code 
Javascript :: dockerfile 
Javascript :: Find the stray number 
Javascript :: jquery import js file 
Javascript :: Ways to iterate array in js 
Javascript :: js add a tag inside span 
Javascript :: mongoBD $inc operator 
Javascript :: while and do while loop in javascript 
Javascript :: copy text on button click in jquery 
Javascript :: jquery show hide based on data attribute 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =