Chrome Autofill/Autocomplete no value for password

后端 未结 20 1966
逝去的感伤
逝去的感伤 2020-11-27 02:57

When you have saved username and password for some site Chrome will autofill that username and password, but if you try to get the value for the password input field it is e

20条回答
  •  野性不改
    2020-11-27 03:18

    Here's my solution to this issue:

    $(document).ready(function(){
      if ( $("input:-webkit-autofill").length ){
        $(".error").text("Chrome autofill detected. Please click anywhere.");
      }
    });
    
    $(document).click(function(){
      $(".error").text("");
    });
    

    Basically, clicking makes the input visible to the user, so I ask the user to click and when they do, I hide the message.

    Not the most elegant solution but probably the quickest.

提交回复
热议问题