-4

I have input box with email address. It should not be auto complete but even after added autocomplete="off" in input box. Its showing auto complete values.

James Z
  • 12,209
  • 10
  • 24
  • 44
  • 2
    `autocomplete` is just a suggestion for the browser, try `autocomplete="nope"` - for more information see: https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion – CD001 Sep 04 '18 at 14:19
  • i tried autocomplete="nope" but no luck – Shashikanth HR Sep 04 '18 at 14:36
  • Possible duplicate of [How do I stop Chrome from yellowing my site's input boxes?](https://stackoverflow.com/questions/175951/how-do-i-stop-chrome-from-yellowing-my-sites-input-boxes) – Lucas Sep 04 '18 at 17:33

1 Answers1

0

it is probably found in chrome...but you can try

in form tag add autocomplete="off" autocomplete="false" autofill="off"

and then add following code after form opens...

<input type="text" name="usernamefake" style="display:none;"> 
<input type="password" name="fakepassword" style="display:none;"> 

<!-- from here now your all input fields...below-->

If your problem doesn't get solve with above solution, you can add one more hidden fake input field just above your actual email input field and have a try...

Update :

you can try

<input type="text" name="email" readonly  onfocus="if (this.hasAttribute('readonly')) {
 this.removeAttribute('readonly');
 this.blur();    this.focus();  }" />

this.blur(); this.focus(); is for mobile screens to show keyboard after readonly attribute is removed..by js

EXAMPLE CODE :

div{
  padding:10px;
  margin:20px;
}
input {
  padding:5px;
  margin:5px;
}
<div>
<form autocomplete="off">
  <label for="email">E-Mail</label>
  <input id="email" readonly type="email" onfocus="if (this.hasAttribute('readonly')) { this.removeAttribute('readonly');
     this.blur();    this.focus();  }" />
  <br/>
  <label for="pw">Password</label>
  <input id="pw" readonly type="password" onfocus="if (this.hasAttribute('readonly')) { this.removeAttribute('readonly');
    this.blur();    this.focus();  }" />
  <br/>
  <input type="submit" value="Go!" />
</form>

</div>