attr('type',"text") и attr('type',"password")
$passwordField = $('.your-selector');
attribites = {
id: $passwordField.attr('id'),
type: $passwordField.attr('type') === 'password' ? 'text' : 'password',
name: $passwordField.attr('name'),
value: $passwordField.attr('value'),
class: $passwordField.attr('class'),
};
$passwordField.replaceWith($('<input/>', attribites));