I have an interface with multiple options/requests to enter a password. I am trying to create one Jquery function to toggle the password visibility for all of them without using specific selectors. My function shows the password on the first click but didn't hide it on the second click. What am I doing wrong here?
$('#toggle_pw_vis').click(function () {
$(this).closest('form').find('input[type=password]').attr('type', $(this).is(':checked') ? 'text' : 'password');
});