I have a lightning-input with type="search". I am having trouble to set autocomplete="off" to be able to disable autocomplete functionality of modern browsers like Chrome.

Any help on this is appreciated!

Thank you!

  • 2
    sounds like your are looking to disable the browser "Autofill" functionality rather than an input field autocomplete ? – glls Apr 16 '19 at 19:19
  • 2
    lightning-input does not have an autocomplete attribute (as far as the docuemntation goes) – glls Apr 16 '19 at 19:20
  • @glls well, we can't ask every client to disable that functionality for all their users can we? – Selçuk Apr 16 '19 at 20:35
  • considering that this is a browser setting - they really dont have a choice – glls Apr 16 '19 at 20:36
  • Possible duplicate of How to set autocomplete="off" in lightning form – shmuels May 16 '19 at 12:37

To switch off browser autofill, try html-autocomplete="nope" Chrome ignores autocomplete="off" but assigning a random string like nope works sometimes.

Alternatively, see MDN docs for disabling autocomplete. The last section describes jquery.disableAutoFill which could be another way of disabling autocomplete.

Not the answer you're looking for? Browse other questions tagged or ask your own question.