show html when a list in the dropdown is selected

Solutions on MaxInterview for show html when a list in the dropdown is selected by the best coders in the world

showing results for - "show html when a list in the dropdown is selected"
Erika
28 Sep 2016
1<!DOCTYPE html>
2<html>
3   <body>
4      <form id="myForm">
5         <select id="selectNow">
6            <option>One</option>
7            <option>Two</option>
8            <option>Three</option>
9         </select>
10         <input type="button" onclick="display()" value="Click">
11      </form>
12      <p>Select and click the button</p>
13      <script>
14         function display() {
15            var obj = document.getElementById("selectNow");
16            document.write(obj.options[obj.selectedIndex].text);
17         }
18      </script>
19   </body>
20</html>