I came across this issue a few days ago. Do you anyone knew how to disable browser autocomplete on the Input element in React.js?? I already tried :
- autoComplete="off"
- autocomplete="new-password"
Both are not working.
Thank you for your answer.
I came across this issue a few days ago. Do you anyone knew how to disable browser autocomplete on the Input element in React.js?? I already tried :
Both are not working.
Thank you for your answer.
Solution from https://www.codementor.io/@leonardofaria/disabling-autofill-in-chrome-zec47xcui
What solved the issue for me is setting the form fields to read only and then removing the attribute once the user focus them.
<input readonly="readonly" onfocus="this.removeAttribute('readonly');" type="text" value="test">
On your input element delete the type attribute and all will be well. Also you don't need the autocomplete.
Yes, neither autoComplete="off" nor autocomplete="new-password" works with chrome.
Adding autocomplete attribute when input is focused works for me
onFocus={(event) => { event.target.setAttribute('autocomplete', 'off'); }}
The tags autoComplete="off" and autocomplete="new-password" does not work with browsers. Add this to the input tags and it will work as expected.
onFocus={(e) => e.target.setAttribute("autoComplete", "none")}