Advertisement
afsarwebdev

password show and hide fontawewome

Mar 5th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //HTML
  2. <div class="ic-single-input ic-show-hide">
  3. <label for="password">Email Address</label>
  4. <span>Min 6 character passwords</span>
  5. <input id="password-field" type="password" class="form-control" name="password" value="secret"><span toggle="#password-field" class="fa fa-fw fa-eye field-icon toggle-password"></span>
  6. </div>
  7.  
  8.  
  9. // hide and show passwords
  10. $(".toggle-password").click(function() {
  11. $(this).toggleClass("fa-eye fa-eye-slash");
  12. var input = $($(this).attr("toggle"));
  13. if (input.attr("type") == "password") {
  14. input.attr("type", "text");
  15. } else {
  16. input.attr("type", "password");
  17. }
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement