Change input from hidden to file - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Hidden


Change input from hidden to file

Demo Code

ResultView the demo in separate window

      <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';

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

Related Tutorials