Good afternoon, there is the following code:
<div class="group-box"> <input type="password" id="password-show" class="modal-input" placeholder="Пароль"> <button type="button" class="show-password"><img src="img/show-password.png" alt="show-pass" /></button> </div>
And the following jQuery code:
$('button.show-password').click(function() { if($('#password-show').attr('type').val() == 'password') { $('#password-show').attr('type').val() = 'text'; } else { $('#password-show').attr('type').val() == 'text'; } });
For some reason it does not work. Uncaught TypeError error occurs: $ (...). Attr (...). Val is not a function
What am I doing wrong?