Để tắt tính năng tự động hoàn thành trường đầu vào, mã như sau -
Ví dụ
<!DOCTYPE html>
<html>
<head>
<style>
input{
font-size: 18px;
padding: 10px;
margin: 10px;
border:1px solid grey;
}
</style>
</head>
<body>
<h1>Autocomplete on/off Example</h1>
<form>
First name: <input type="text" name="firstName" autocomplete="off"><br>
Last name: <input type="text" name="lastName" autocomplete="on"><br>
<input type="submit">
</form>
<h2>Type in the above fields and refresh page to see autocomplete at work</h2>
</body>
</html> Đầu ra
Đoạn mã trên sẽ tạo ra kết quả sau -
Khi nhập nội dung nào đó vào các trường trên sau khi gửi biểu mẫu một lần -