The input list attribute points to a <datalist> element containing predefined options for an <input> element.
Example
An <input> element linked to predefined values within a <datalist>:
<form> <input list=”browsers”> <datalist id=”browsers”> <option value=”Edge”> <option value=”Firefox”> <option value=”Chrome”> <option value=”Opera”> <option value=”Safari”> </datalist> </form> |
The autocomplete
attribute controls whether a form or input field allows the browser to suggest previously entered values, aiding user input. It applies to <form>
elements and input types like text, email, and date pickers.
Example
An HTML form with autocomplete enabled, and disabled for a specific input field:
<form action=”/action_page.php” autocomplete=”on”> <label for=”fname”>First name:</label> <input type=”text” id=”fname” name=”fname”><br><br> <label for=”lname”>Last name:</label> <input type=”text” id=”lname” name=”lname”><br><br> <label for=”email”>Email:</label> <input type=”email” id=”email” name=”email” autocomplete=”off”><br><br> <input type=”submit” value=”Submit”> </form> |