get selected value of dropdown in javascript
JavaScript
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 text <body>
<select id="list" style="padding: 10px;" onchange="getSelectValue();">
<option value="js">JavaScript</option>
<option value="php">PHP</option>
<option value="c#">Csharp</option>
<option value="java">Java</option>
<option value="node">Node.js</option>
</select>
<script>
function getSelectValue()
{
var selectedValue = document.getElementById("list").value;
alert(selectedValue);
}
getSelectValue();
</script>
</body>let selectElement = document.getElementById("selectElement");
let valueSelected = selectElement.options[selectElement.selectedIndex].value; // get selected option value
var text= selectElement.options[selectElement.selectedIndex].text; //get the selected option text
Also in JavaScript:
- Title
- how to change input value in javascript using class
- Category
- JavaScript
- Title
- convert dictionary to json serialization swift 4
- Category
- JavaScript
- Title
- body-parser node
- Category
- JavaScript
- Title
- how to set up a json file
- Category
- JavaScript
- Title
- google script get name of google form
- Category
- JavaScript
- Title
- how to delay redirect in javascript
- Category
- JavaScript
- Title
- discord.js dm user
- Category
- JavaScript
- Title
- angular bootstrap not working
- Category
- JavaScript
- Title
- funcion dentro de objeto
- Category
- JavaScript
- Title
- how to write a program that alerts the current month in words in javascript
- Category
- JavaScript
- Title
- how to make fizzbuzz in javascript
- Category
- JavaScript
- Title
- how to check if object has key javascript
- Category
- JavaScript
- Title
- change js to json
- Category
- JavaScript
- Title
- if statement in javascript
- Category
- JavaScript
- Title
- component navigation without changin the url react router
- Category
- JavaScript
- Title
- getFullYear within moment in angular
- Category
- JavaScript
- Title
- how to make javascript function consise
- Category
- JavaScript
- Title
- how to reload vscode
- Category
- JavaScript
- Title
- get data from json using jquery
- Category
- JavaScript
- Title
- how to add two attay into object in javascript
- Category
- JavaScript
- Title
- export apk react native
- Category
- JavaScript
- Title
- how to return the number of nodes in a linked list
- Category
- JavaScript
- Title
- how to create a 30 seconds timer using js
- Category
- JavaScript
- Title
- how to turn decimales into percents with javascript
- Category
- JavaScript
- Title
- greater than or equal to javascript
- Category
- JavaScript
- Title
- how to detect a button click in javascript
- Category
- JavaScript
- Title
- for of array javascript
- Category
- JavaScript
- Title
- how to apply gavity to code in javascript
- Category
- JavaScript
- Title
- angular event scroll end of page
- Category
- JavaScript
- Title
- install nuxt js
- Category
- JavaScript
- Title
- error duplicate resources react native
- Category
- JavaScript
- Title
- background-image url not working
- Category
- JavaScript
- Title
- how to loop audio in js
- Category
- JavaScript
- Title
- axios delete request payload
- Category
- JavaScript
- Title
- change p tag text javascript
- Category
- JavaScript
- Title
- bracket notation javascript
- Category
- JavaScript
- Title
- declare function javascript
- Category
- JavaScript
- Title
- import axios react
- Category
- JavaScript
- Title
- how to use style in react js
- Category
- JavaScript
- Title
- express js redirect to url
- Category
- JavaScript
- Title
- how to send an alert in javascript
- Category
- JavaScript
- Title
- insert into specific array index that has a value existing on that index
- Category
- JavaScript
- Title
- how to get last string in javascript
- Category
- JavaScript
- Title
- angular size of array
- Category
- JavaScript
- Title
- get url react
- Category
- JavaScript
- Title
- get value javascript
- Category
- JavaScript
- Title
- javascript closure stack overflow
- Category
- JavaScript
- Title
- dynamodb get all items nodejs
- Category
- JavaScript
- Title
- filter out arrays js
- Category
- JavaScript
- Title
- filter javascript array
- Category
- JavaScript
- Title
- How can I upload files asynchronously
- Category
- JavaScript
- Title
- Alert.alert closing expo
- Category
- JavaScript
- Title
- como diminuir quantidade de casas decimais javascript
- Category
- JavaScript
- Title
- ajax laravel example
- Category
- JavaScript
- Title
- graphql yoga access http headers
- Category
- JavaScript
- Title
- angular material toolbar with logo
- Category
- JavaScript
- Title
- how to make a page relode on a keypress in js
- Category
- JavaScript
- Title
- get value of all checked boxes jquery
- Category
- JavaScript
- Title
- async await javascript
- Category
- JavaScript
- Title
- base64 decode javascript
- Category
- JavaScript
- Title
- Javascript compare two dates
- Category
- JavaScript
- Title
- angular reactive form get form control template
- Category
- JavaScript
- Title
- conditional rendering with radio buttons
- Category
- JavaScript
- Title
- expo open app settings
- Category
- JavaScript
- Title
- how to return an object in javascript
- Category
- JavaScript
- Title
- add firebase in react
- Category
- JavaScript
- Title
- how to get unique values from array in javascript without duplicate value
- Category
- JavaScript
- Title
- express router file
- Category
- JavaScript
- Title
- hwo to cehck req header in js
- Category
- JavaScript
- Title
- how to use custom stylesheets express node
- Category
- JavaScript
- Title
- how to clone an object
- Category
- JavaScript
- Title
- firestore update map
- Category
- JavaScript
- Title
- hover jquery
- Category
- JavaScript
- Title
- console.log object to json
- Category
- JavaScript
- Title
- dropdown list value react fragment
- Category
- JavaScript
- Title
- gulp-download-stream
- Category
- JavaScript
- Title
- how to refrence image in dart angular
- Category
- JavaScript
- Title
- javascript audio stop
- Category
- JavaScript
- Title
- create element javascript with id
- Category
- JavaScript
- Title
- check if var is NaN
- Category
- JavaScript
- Title
- axios js and react
- Category
- JavaScript
- Title
- how to animate array oy react elements
- Category
- JavaScript
- Title
- headroom js react
- Category
- JavaScript
- Title
- and javascript
- Category
- JavaScript
- Title
- ajax .put
- Category
- JavaScript
- Title
- how to attach javascript to html
- Category
- JavaScript
- Title
- email regex javascript
- Category
- JavaScript
- Title
- express fingerprint
- Category
- JavaScript
- Title
- disable autocomplete javascript
- Category
- JavaScript
- Title
- how to remove duplicate array object in javascript
- Category
- JavaScript
- Title
- if mousepressed javascript
- Category
- JavaScript
- Title
- Appending the option element using jquery each function
- Category
- JavaScript
- Title
- Javascript clear canvas
- Category
- JavaScript
- Title
- array javascript django
- Category
- JavaScript
- Title
- how to add class to button in javascript
- Category
- JavaScript
- Title
- clear cookies js
- Category
- JavaScript
- Title
- can't bookmark react router
- Category
- JavaScript
- Title
- javascript check if empty
- Category
- JavaScript
- Title
- cannot use getidtoken if null
- Category
- JavaScript
- Title
- Django application with User and ActivityPeriod models, write a custom management command to populate the database with some dummy data, and design an API to serve that data in the json format given above.
- Category
- JavaScript