Select option value | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Select option value

I create a test and I can’t get the value of selected item in <select><option> how can I do this? I tried a lot of codes...

10th Mar 2019, 12:02 PM
Sonia Golubkova
Sonia Golubkova - avatar
3 Answers
+ 3
var sel = document.getElementById("sel"); // select element var selected = sel.options[sel.selectedIndex].value; https://code.sololearn.com/WT8wFn67dAwV/?ref=app
10th Mar 2019, 12:22 PM
Calviղ
Calviղ - avatar
+ 2
its actualy worked! thank you!!
11th Mar 2019, 11:00 AM
Sonia Golubkova
Sonia Golubkova - avatar
+ 2
Can you help an amateur
26th Mar 2019, 1:18 AM
Aminu Kazaure
Aminu Kazaure - avatar