To trigger autofill, there is one prerequisite:
- There needs to be an input element with type="password".
When you want to disable autofill,
add autocomplete="new-password" to the input element.
However, this only stops it from filling in the field initially.
The browser will still remember values and show them as suggestions in a popup.
<form>
<input
type="email"
required
name="email"
placeholder="email"
/>
<input
type="password"
required
name="password"
placeholder="password"
/>
<button
type="submit"
>
Login
</button>
</form>
<form>
<input
type="email"
required
name="email"
placeholder="email"
/>
<input
type="password"
required
name="password"
autocomplete="new-password"
placeholder="password"
/>
<button
type="submit"
>
Login
</button>
</form>