Skip to content

Instantly share code, notes, and snippets.

@Potherca
Last active August 5, 2025 10:24
Show Gist options
  • Save Potherca/6109744 to your computer and use it in GitHub Desktop.
Save Potherca/6109744 to your computer and use it in GitHub Desktop.
Turn things of for the HTML input element.

Prevent browser behavior for the HTML <input> Element using tag Attributes

Sometimes, browsers seem to have a mind of their own. As a developer, your create a form, and the browser adds all sorts of behavior. The most obvious of these are automatically filling a form, or autocorrecting your typing.

When using the <input> element for textual input, there are several attributes that can disable such behavior in a user's browser.

Then there is also an attribute that needs to be set on the <form> element:

  • novalidate Prevent the browser from validating the form when submitted
<form novalidate>
    <input name="some_name" type="text"
        autocapitalize="none"
        autocomplete="off"
        autocorrect="off"
        spellcheck="false"
    />
    
    <input name="some_name" type="password"
        class="keeper-ignore"
        data-1p-ignore
        data-bwignore
        data-form-type="other"
        data-lpignore="true"
        data-protonpass-ignore="true"
   />
</form>

Footnotes

  1. Sadly, this is not always respected by browsers, for instance when the name equals (or starts with) email or username.

  2. This can be influenced by using autocomplete="current-password" or autocomplete="new-password".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment