ILIAS ILIAS - 1 year ago 126
HTML Question

Clear password field

<input name="e_password" id="e_password" type="password" autocomplete="off" />

The above is a password field which for some reason, is automatically filled only in Mozilla (not in Chrome and IE11). Obviously it keeps the value field from previous trials. I tried so much to clear this field. The only way I can manage it, is through the following:


Unfortunately, the above resets all the other text fields inside the form which is undesirable. Also,


does not work!
Moreover, I tried this:

<div class="abc">
<input name="e_password" id="e_password" type="password" autocomplete="off" />

$('.abc input:text').val('');

Nor, this works...
Of course, I tried the obvious:


which also did not work.
I repeat that the problem exists only in Mozilla. What else may I do?

Thank you

Answer Source

I found it!!

setTimeout(function(){ $('#e_password').val('');}, 50);

Hopefully, the above works. However, I cannot give a satisfactory explanation why this small delay solves the problem...Most probably, it is a Mozilla bug.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download