I have 2 basic forms -- sign in and sign up, both on the same page. Now, I have no problem with the sign in form auto-filling, but the sign up form auto fills as well, and I don't like it.
Also, the form styles get a yellow background which I can't manage to override and I don't want to use inline CSS to do so. What can I do to make them stop being colored yellow and (possibly) auto filling? Thanks in advance!
Simple javascript solution for all browser:
Clone input, reset attribute and hide original input. Timeout is needed for iPad
for the autocompletion, you can use:
regarding the coloring-problem:
from your screenshot i can see that webkit generates the following style:
1) as #id-styles are even more important than .class styles, the following may work:
2) if that won't work, you can try to set the style via javascript programmatically
3) if that won't work,
you're doomed :-)consider this: this wont hide the yellow color, but will make the text readable again.4) a css/javascript solution:
css:
and the following javascript has to be run onload:
eg:
good luck :-)
5) If none of the above work try removing the input elements, cloning them, then placing the cloned elements back on the page (works on Safari 6.0.3):
6) From here:
You can disable auto-completion as of HTML5 (via
autocomplete="off"
), but you CAN'T override the browser's highlighting. You could try messing with::selection
in CSS (most browsers require a vendor prefix for that to work), but that probably won't help you either.Unless the browser vendor specifically implemented a vendor-specific way of overriding it, you can't do anything about such styles that are already intended to override the site's stylesheet for the user. These are usually applied after your stylesheets are applied and ignore
! important
overrides, too.If it's in input field you're trying to "un-yellow" ...
So, it might look like this:
After trying a lot of things, I found working solutions that nuked the autofilled fields and replaced them with duplicated. Not to loose attached events, i came up with another (a bit lengthy) solution.
At each "input" event it swiftly attaches "change" events to all involved inputs. It tests if they have been autofilled. If yes, then dispatch a new text event that will trick the browser to think that the value has been changed by the user, thus allowing to remove the yellow background.
Since the browser searches for password type fields, another workaround is to include a hidden field at the beginning of your form: