Hi I have dojo based website which does not support Jqquery. So I need a javascript code to get the selected value text from the dropdown . Can anyone give me plain javascript code?
Asked
Active
Viewed 785 times
-4
-
2What if you ask that directly to Google? xD – Jorge Fuentes González Feb 17 '17 at 14:31
1 Answers
1
It's not that difficult, you could try to do it by yourself.
var sel = document.getElementById('select');
function getVal(){
console.log(sel.value);
}
<select id='select'>
<option value='one'>one</option>
<option value='two'>two</option>
<option value='three'>three</option>
</select>
<button onclick='getVal()'>Get value</button>

kind user
- 40,029
- 7
- 67
- 77