Turn off Autocomplete for Input in React
In this short article, we are going to learn how to disable autocomplete of an input field in React. Let’s see:
Table of Contents
Disable in Specefic Input
To disable autocomplete for a specific input field, we need to set autoComplete
attribute to off
. Example:
import React from "react";
export default function App() {
return (
<div theClassName="App">
<input type="text" autoComplete="off"/>
</div>
);
}
Disable in Entire Form
To disable autocomplete for an entire form, we need to set autoComplete
attribute with off
value in the form like this:
import React from "react";
export default function App() {
return (
<div theClassName="App">
<form autoComplete="off">
<input type="text"/>
</form>
</div>
);
}
That’s it. Thanks for reading.
Md Obydullah
Software Engineer | Ethical Hacker & Cybersecurity...
Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.