Posts Tagged ‘jQuery’

Hide password with jQuery

No Comments »
Simple javascript to toggle password visibility Your HTML structure nneded for this to work is as simple as:
my_secret_password
Add javascript
$(function() {
/**
* Hide password with bulets and make it toggle
*/
$("div.password").contents().wrap('<span class="pass" />');
$('span.pass').before('<span class="bullets">&bull;&bull;&bull;&bull;</span>').hide();
$("div.password").click(function(){
$('span.pass',this).toggle();
$('span.bullets',this).toggle();
});
});
And the result is:
my_secret_password