how can i make a button to hide and show passwords
i wote that code but doesn't work
i wote that code but doesn't work
- Code:
$(function(){
$('input[name="password"]').replaceWith('<input type="password" name="password" size="25" maxlength="25" class="inputbox autowidth" /> <span style="font-family: FontAwesome;" id="shIcon"></span>');
$('input[name="password"]').attr('id', 'password');
});
var myInput = document.getElementById("password"),
myBtn = document.getElementById("shIcon");
myBtn.onclick = function () {
if (this.textContent === "" ) {
myInput.setAttribute('type','text');
this.textContent('')
} else {
myInput.setAttribute('type','password');
this.textContent('');
}
};