How to get drop down value when drop down change using javascript

27-02-2017 onchange events dropdown javascript functions

Here is the sample example to the get value from the drop down

 Here the code is 

<script>
function changeFunction(){
	var color = document.getElementById('color').value;
	alert(color);
}
</script>
<select onchange="changeFunction()" id="color">
<option value="black">Select Black</option>
<option value="red">Select Red</option>
<option value="blue">Select Blue</option>
<option value="green">Select Green</option>
</select>

 

You might also like:

Functions in javascript
25-05-2018 functions javascript es5 es6 arrow functions named functions Closures Nested Functions Callbacks Arrow functions.
How to upload file by using request module
18-03-2017 request module node js
How to get current date and time (yyyy-mm-dd H:i:s) using javascript
09-03-2017 javascript date time
Remove last two characters from given string
06-03-2017 substring javascript remove
Change datepicker display format
06-03-2017 datepicker angular js