autocomplete="off" force in browser

27,675

Solution 1

Or add with jQuery: $("input, select, textarea").attr("autocomplete", "off");

Solution 2

Worked for Chrome onFocus remove readonly - but onBlur you have to re-write it. So:

onFocus="this.removeAttribute('readonly');"
onBlur="this.setAttribute('readonly', true);"

This did the trick. For IE and Firefox I added in any case the autocomplete="off" with jQuery on "ready" function to all fields that might need it (marking them with a class (or cssclass):

$(document).ready(function () {
    $(".noautocomplete").attr("autocomplete", "off");
});

Solution 3

The W3Schools states (tested):

<input type="email" name="email" autocomplete="off" />

Please note that this is defined in HTML5

For previous version see this SO

Share:
27,675
Sunny Patel
Author by

Sunny Patel

Updated on August 13, 2021

Comments

  • Sunny Patel
    Sunny Patel almost 3 years

    I have a login form and I NEED to force autocomplete to off. i have tried

    jquery: $('#login').attr("autocomplete", "off");

    HTML: <input ... autocomplete="off">

    Javascript: document.getElementById('myInputId').autocomplete = 'off';

    When I click the login input box a drop down appears across all browsers FF, Chrome, IE..

    N.B. this applies to users who have previously saved password information They need to forced to enter login details