Change value of display:none input field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Change value of display:none input field

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Input Text To Dropdown Box</title> 
      <script type="text/javascript">
function swap() {/*  www.  j  av  a  2  s. com*/
document.getElementById("contentswap").innerHTML = "<select><option value='cats'>Cats</option><option value='dogs'>Dogs</option></select>";
}

      </script> 
      <style>

#contentswap {
   display:inline;
}

      </style> 
   </head> 
   <body <div id="contentswap"> 
      <input type="text" name="original">  
      <br> 
      <input type="button" value="Input To Select" onClick="swap()">  
   </body>
</html>

Related Tutorials