Stop LastPass filling out a form

前端 未结 13 1775
遇见更好的自我
遇见更好的自我 2020-12-07 13:38

Is there a way to prevent the LastPass browser extension from filling out a HTML-based form with a input field with the name \"username\"?

This is an hidden field,

13条回答
  •  醉酒成梦
    2020-12-07 14:10

    This ES6 style code was helpful for me as it added data-lpignore to all my input controls:

    const elements = document.getElementsByTagName("INPUT");
    for (let element of elements) {
        element.setAttribute("data-lpignore", "true");
    }
    

    To access a specific INPUT control, one could write something like this:

    document.getElementById('userInput').setAttribute("data-lpignore", "true");
    

    Or, you can do it by class name:

    const elements = document.getElementsByClassName('no-last-pass');
    for (let element of elements) {
        element.setAttribute("data-lpignore", "true");
    }
    

提交回复
热议问题