-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
When using example on a password field, you just get a string of stars, not very usefull.
I've used this rather ugly code to change a password field to a text field, when the example text is shown:
$('form').on('blur','input[type="password"]',function(){
if ($(this).val() === '') {
$(this).replaceWith(function(){
return $(this).clone(true).attr('type','text').val($(this).attr('title')).addClass('was-password').addClass('example');
});
}
}).on('focus','input.was-password',function(){
$(this).replaceWith(function(){
return $(this).clone(true).attr('type','password').val('').removeClass('was-password').removeClass('example').addClass('set-focus');
});
$('input.set-focus').focus().removeClass('set-focus');
})
$('input[type="password"]').replaceWith(function(){
if ($(this).val() === $(this).attr('title')) {
return $(this).clone(true).attr('type','text').addClass('was-password').addClass('example');
} else {
return $(this).clone(true);
}
});
Think something similar should be implemented in core. The reason why I'm replacing the input rather than just changing the type attribute is due to some security rule preventing the transform.
Metadata
Metadata
Assignees
Labels
No labels