Reactjs Autocomplete : 'off'
Solution 1:
<inputname="my-field-name"autoComplete="new-password" />
Worked for me đź‘Ť
Solution 2:
It seems autoComplete="off"
or autoComplete="new-password"
works, but after the form is used multiple times it starts saving the values of the field to whatever string you set for the autoComplete.
I've tried numerous strings for the autoComplete, but it always ends up coming back. The best solution I have found for this is to generate a new string for the autoComplete every time. I have been doing that like so with no issues:
<input name="field-name" autoComplete={'' + Math.random()} />
Solution 3:
You have to wrap input tag into form:
<formautocomplete="off"><inputtype="text" /></form>
Solution 4:
You need to use autoComplete="off"
. See working example.
constElement = () => (
<div><inputname="email"autoComplete="off" /></div>
);
ReactDOM.render(
<Element />,
document.getElementById('root')
);
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script><divid="root"></div>
Solution 5:
It should be autocomplete="off"
.
But keep in mind that chrome officially ignores this and will use autocomplete anyway. Take a look here for some workarounds
Post a Comment for "Reactjs Autocomplete : 'off'"