How to trigger Autofill in Google Chrome with HTML?

Spread the love

Sometimes, we want to trigger Autofill in Google Chrome with HTML.

In this article, we’ll look at how to trigger Autofill in Google Chrome with HTML.

How to trigger Autofill in Google Chrome with HTML?

To trigger Autofill in Google Chrome with HTML, we set the autocomplete attribute.

For instance, we write

<label for="frmNameA">Name</label>
<input
  type="text"
  name="name"
  id="frmNameA"
  placeholder="Full name"
  required
  autocomplete="name"
/>

<label for="frmEmailA">Email</label>
<input
  type="email"
  name="email"
  id="frmEmailA"
  placeholder="name@example.com"
  required
  autocomplete="email"
/>

<label for="frmPhoneNumA">Phone</label>
<input
  type="tel"
  name="phone"
  id="frmPhoneNumA"
  placeholder="+1-555-555-1212"
  required
  autocomplete="tel"
/>

to set the name and autocomplete attributes to the same values to trigger autocomplete on the fields.

Conclusion

To trigger Autofill in Google Chrome with HTML, we set the autocomplete attribute.

Leave a Reply

Your email address will not be published.