Change input from hidden to file - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Hidden

Description

Change input from hidden to file

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function show(x, y) {//from  w  w  w . ja va  2  s.c  o  m
    if (document.getElementById(y).checked) {
        document.getElementById(x).type = 'text';
    } else {
        document.getElementById(x).type = 'hidden';
    }
}

      </script> 
   </head> 
   <body> 
      <input id="txt" type="text" value="Hello"> 
      <input id="chk" type="checkbox" checked onclick="show('txt', 'chk')">  
   </body>
</html>

Related Tutorials