+ 2
Pls how can I do this?
When a form is made and I want to console.log the name the input. It can be done with name.value. but how can I output what the user input In a drop-down list.
4 Respostas
+ 8
🔸HTML :
<select id="drop-down">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<button onclick="show_val()">Output Drop-down Value</button>
🔸 JavaScript :
function show_val(){
console.log(document.getElementById("drop-down").value)
}
+ 3
This can be done for example in this way:
https://code.sololearn.com/WsJl7PZTN57L/?ref=app
+ 3
Thanks a lot😊
+ 2
https://code.sololearn.com/Wm4yeI9h9XqM/?ref=app
Elijah Adebanwo
It'll Display value on the time it's selected.