Removing input background colour for Chrome autocomplete?

前端 未结 30 2647
失恋的感觉
失恋的感觉 2020-11-22 04:02

On a form I\'m working on, Chrome is auto-filling the email and password fields. This is fine, however, Chrome changes the background colour to a pale yellow colour.

30条回答
  •  忘掉有多难
    2020-11-22 04:27

    None of the solutions worked for me, the inset shadow won't work for me because the inputs have a translucent background overlaid over the page background.

    So I asked myself, "How does Chrome determine what should be autofilled on a given page?"

    "Does it look for input ids, input names? Form ids? Form action?"

    Through my experimentation with the username and the password inputs, there were only two ways I found that would cause Chrome to not be able to find the fields that should be autofilled:

    1) Put the password input ahead of the text input. 2) Give them the same name and id ... or no name and id at all.

    After the page loads, with javascript you can either dynamically change the order of the inputs on the page, or dynamically give them their name and id ...

    And Chrome doesn't know what hit it ... autocomplete is broken!

    Crazy hack, I know. But it's working for me.

    Chrome 34.0.1847.116, OSX 10.7.5

提交回复
热议问题