Add Autocomplete Attributes to Form Input Elements


#1

Google Chrome is actively promoting autocomplete attributes:

Let’s get these added to Unbounce be default (in addition to HTML5 Field Types).

HTML Spec:
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute


#2

I added the attributes with javascript.

//Autocomplete Attributes
document.getElementsByClassName('lp-pom-form')[0].getElementsByTagName('form')[0].autocomplete = 'on';
document.getElementById('phone_number').autocomplete = 'tel-national mobile';
document.getElementById('email').autocomplete = 'email';
document.getElementById('first_name').autocomplete = 'given-name';
document.getElementById('last_name').autocomplete = 'family-name';

However, I am not sure if this will even work since the browser may ignore them if they aren’t there when the document is loaded.