Answers for "Show html when a list in the dropdown is selected"

0

Show html when a list in the dropdown is selected

<!DOCTYPE html>
<html>
   <body>
      <form id="myForm">
         <select id="selectNow">
            <option>One</option>
            <option>Two</option>
            <option>Three</option>
         </select>
         <input type="button" onclick="display()" value="Click">
      </form>
      <p>Select and click the button</p>
      <script>
         function display() {
            var obj = document.getElementById("selectNow");
            document.write(obj.options[obj.selectedIndex].text);
         }
      </script>
   </body>
</html>
Posted by: Guest on June-22-2020

Code answers related to "Show html when a list in the dropdown is selected"

Browse Popular Code Answers by Language