How do you tell if a browser has auto filled a text-box? Especially with username & password boxes that autofill around page load.
My first question is when does
There does appear to be a solution to this that does not rely on polling (at least for Chrome). It is almost as hackish, but I do think is marginally better than global polling.
Consider the following scenario:
User starts to fill out field1
User selects an autocomplete suggestion which autofills field2 and field3
Solution: Register an onblur on all fields that checks for the presence of auto-filled fields via the following jQuery snippet $(':-webkit-autofill')
This won't be immediate since it will be delayed until the user blurs field1 but it doesn't rely on global polling so IMO, it is a better solution.
That said, since hitting the enter key can submit a form, you may also need a corresponding handler for onkeypress.
Alternately, you can use global polling to check $(':-webkit-autofill')