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

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.

Use java script file client side and server side at a time in node js

30-07-2017 node js include call javascript

How to submit form using javascript or jquery.

16-04-2017 javascript jquery submit form

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

27-02-2017 onchange events dropdown javascript functions

How to remove last / value from url in javascript

27-02-2017 array javascript last value