Javascript examples for DOM HTML Element:Input Text
Change input field type
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function show(x, y) {/*from ww w . java2s . com*/ 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>