sametk
sametk

Reputation: 11

Turning Off Autocomplete for "password" input fields in Chrome

How can I turn Off Autocomplete for password input fields in a html form.

or

Upvotes: 0

Views: 1268

Answers (2)

Yasaman.Mansouri
Yasaman.Mansouri

Reputation: 560

to hide your saved password or any text input that is saved make your input "readonly" and change "onfocus" like this.

<input readonly onfocus="this.removeAttribute('readonly');" autocomplete="off" type="password">

Upvotes: 2

sametk
sametk

Reputation: 11

Browser first fill username than fill password.This code worked for me :D

$('#gsmloginnum').on('input', function() {
        $('#gsmPassword').prop("readonly", true);
        $( "#gsmPassword").css("border-color", "#fff");
    });

 $( "#gsmPassword" ).focus(function() {
        $( "#gsmPassword").removeAttr("readonly");

    });

Upvotes: 0

Related Questions