One of our users just brought up the fact that their browsers Autofill doesn't cause JS onChange events to fire; this causes a problem with user registration for us.
Is this by design? Is there a way to work around it?
On your Android device, open the Chrome app. Then, tap on the three-dot menu button at the top-right corner and select “Settings” from the drop-down menu. 2. Now, just like on the desktop version, you have to disable autofill individually for all three categories – Passwords, Payment methods, & Addresses and more.
In web browsers, autofill is a feature that automatically populates form fields with previously-entered information, such as passwords, addresses, and credit card data. For this sensitive information to be stored, the autofill feature must be enabled and have appropriate permissions.
Open Chrome and click on your profile icon in the top-right corner. Select either Payment options or Addresses and more to see the information autocomplete is currently using. Toggle the Save and fill addresses or Save and fill passwords switch depending on whether or not you want to use autocomplete.
One solution I have been using occasionally is to check whether the value of the field/input/select differs from it's defaultValue. defaultValue would be the value that was originally in the markup, and value is the current value aka selected or entered value. This would probably differ even though the form was autopopulated.
If you want to turn off autofill altogether, it might be wise to add autocomplete="off" on fields that are directly connected to your logic.
If you want to get the autofill behaviour but change the styling, maybe you can do something like this (jQuery
):
$(window).load(function(){
if($('input:-webkit-autofill')){
$('input:-webkit-autofill').each(function(){
//put your conditions here
});
// RE-INITIALIZE VARIABLES HERE IF YOU SET JQUERY OBJECT'S TO VAR FOR FASTER PROCESSING
}});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With