Removing input background colour for Chrome autocomplete?

前端 未结 30 1947
失恋的感觉
失恋的感觉 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:30

    Unfortunately strictly none of the above solutions worked for me in 2016 (a couple years after the question)

    So here's the aggressive solution I use:

    function remake(e){
        var val = e.value;
        var id = e.id;
        e.outerHTML = e.outerHTML;
        document.getElementById(id).value = val;
        return true;
    }
    
    
    

    Basically, it deletes the tag while saving the value, and recreates it, then puts back the value.

提交回复
热议问题