HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Try to change the value in select tag</p> <select id="mySelect"> <option>Harley Davidson</option> <option>Honda</option> <option>Suzuki</option> <option>Yamaha</option> </select> <p id="point"></p> <script> var x = document.getElementsByTagName("select")[0]; function myFunction() { var x = document.getElementById("mySelect").value; document.getElementById("point").innerHTML = "You selected: "+x; } x.addEventListener("change", myFunction); </script> </body> </html>
OUTPUT
×

Save as Private