Menu

The autocomplete attributes that let a checkout form fill itself in
📰

The autocomplete attributes that let a checkout form fill itself in

DEV Community: html·RAMO·about 14 hours ago
#saDCORoY
#devto2#devto#dev#address#name
Reading 0:00
15s threshold

Most people don't type their address into a checkout form. Their browser or password manager does it for them, in one tap, if the form lets it.

Whether that tap works comes down to a handful of HTML attributes that are easy to skip. When they're missing, autofill guesses. Sometimes it guesses right. Sometimes it puts the street name in the city field and the customer has to clean it up on a phone keyboard.

Here's what I'd put on every field of a typical checkout.

The basic set

<form method = "post" action = "/checkout" > <label for = "name" > Full name </label> <input id = "name" name = "name" autocomplete = "name" >

<label for = "email" > Email </label> <input id = "email" name = "email" type = "email" autocomplete = "email" >

<label for = "tel" > Phone </label> <input id = "tel" name = "tel" type = "tel" autocomplete = "tel" >

<label for = "street" > Street and number </label> <input id = "street" name = "street" autocomplete = "shipping street-address" >

<label for = "city" > City </label> <input…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.