Removing input background colour for Chrome autocomplete?

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

    I give up!

    Since there is no way to change the color of the input with autocomplete I decide to disable all of them with jQuery for webkit browsers. Like this:

    if (/webkit/.test(navigator.userAgent.toLowerCase())) {
        $('[autocomplete="on"]').each(function() {
            $(this).attr('autocomplete', 'off');
        });
    }
    

提交回复
热议问题