Prevent password field from autocomplete

Hello experts
I have a problem creating my login form.
I'm using jquery. On page load i'm running a script to reset all fields
function clearForm(a){$(a).find(":input").each(function(){switch(this.type){case"password":case"select-multiple":case"select-one":case"text":case"textarea":$(this).val("");break;case"checkbox":case"radio":this.checked=false}})};
$(function () {clearForm('#insertform')});

Open in new window

My password field is:
<input name = "luserpassword" 
               id   = "luserpassword" 
               type = "password" 
               class= "element_288 isrequired"  
               value= "#Form.luserpassword#">

Open in new window

Unfortunately if i write my testemail i get on blur the password input filled.
Any idea how to solve this?
I have noticed this on firefox.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
unfortunately there is not that much you can do about this.
Firefox, IE 11 and others have stopped supporting autocomplete=off - and therefore their built-in Password Manager still will store the passwords (depends on the client configuration).
See also the initial discussion on Firefox dev team bug post:

One workaround would be to have the user/login input on the first page and the password on another, because then most password manager do not offer autocomplete as they have no relation between the two input fields on two different pages.
PanosAuthor Commented:
Hi Rainer Jeschor
Thank you for your post.
I found a way to solve this using the onblur function:
var pw = $.trim($('#lpassword').val());
$('#lemail').bind("blur", function () {

Open in new window

This works fine but not if i select an email from the cached values while typing. I hope you understand what i mean. Is there any function that i can use in this case?
PanosAuthor Commented:
Hi again.
This jquery pugin is doing the job:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rainer JeschorCommented:
wow cool - I should monitor the jQuery plugin section more often - it seems there is nearly always a plugin to solve a problem.
PanosAuthor Commented:
I'm selecting my own comment because this was the solution of my problem
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.