Site icon SumTips

Show-Hide Password in a Field

By using jQuery, you can easily transform a password field to a text field and allow your users to view password they typed in a field.

Code:

<label>Password:</label>
<input type="password" id="password" name="pass"/>
<a href="javascript:void(0);" class="show-hide-pass" onclick="document.getElementById('password').type='text';$('.show-hide-pass').toggle();">Show Password</a>
<a href="javascript:void(0);" style="display:none;" class="show-hide-pass" onclick="document.getElementById('password').type='password';$('.show-hide-pass').toggle();">Hide Password</a>

View: Demo

Exit mobile version