Javascript dynamically changes the Imput type attribute:
Code implementation:
<script type= "Text/javascript" >
function Shoppw (thebox) {
var ps = document.getElementById (' ps ');
var pass = document.getElementById (' pass ');
Ps.removechild (pass);
var psimput = document.createelement ("INPUT");
if (pass.type = = ' password ') {
psimput.type = ' text ';
} else {
psimput.type = ' password ';
}
psimput.id = ' pass ';
Psimput.name = "password";
Psimput.maxlength= ";
" Ps.appendchild (psimput);
}
</script>
HTML code:
<TD class= "Label" > * <label for= "password" accesskey= "" > Login password:</label></td>
<td > <div id= "PS" ><input type= "text" name= "password" maxlength= "" id= "pass"/></div> <input
Name= "CheckBox2" type= "checkbox" Value= "true" checked= "Checked" id= "show" onclick= "SHOPPW (This)"/>
For= "Show" accesskey= "" > Display </label></td>
Can dynamically change the type attribute value of a imput element at run time
Thank you for reading, I hope to help you, thank you for your support for this site!