How to prevent browser to remember password on User pages / Log in?

I used the following code to modify Log In form input fields, but without success. I’ve tested autocomplete = “off” and autocomplete = “new-password”. Can someone help me?

function setFieldValues() {
document.getElementById("wf-log-in-email").autocomplete = "off";
//document.getElementById("wf-log-in-email").autocomplete = "new-password";

// reset password
document.getElementById("wf-log-in-password").autocomplete = "off";
//document.getElementById("wf-log-in-password").autocomplete = "new-password";
// Alternative to DOMContentLoaded event
document.onreadystatechange = () => {
  if (document.readyState === "interactive") {

You really can’t. Browsers prioritize user convenience, so many will ignore autocomplete=off for a login form.

There are hacks you can use, such as changing field names and types, but they won’t work in this case since they would break the login form itself.