-4

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?

pradeep
  • 45
  • 7

1 Answers1

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