0

So here I've a page to change password, but before that I've Login page where user logs in and say he has clicked browser's default functionality Remember me or Save Password or anything it prompts during login, and saves the password!!

Now when I load my change password partial view the textbox say with ID txtOldPassword will be filled by default whereas textboxes txtNewPassword and txtConfirmPassword will be left empty!!

I load my PartialView as below and tried to clear the txtOldPassword value!!

$('.menu').on('click',function(){
     $('#body_data').load('/Home/GetChangePassword',function(){
             $('#txtOldPassword').val(''); //Tried to clear the value here       
     });
});

But still the value exists!!! Now, I don't want to disable the browser's default functionality but I just want to remove the password that automatically comes and stores in textbox txtOldPassword!!

Guruprasad J Rao
  • 29,410
  • 14
  • 101
  • 200

2 Answers2

1

Latest browser which supports html5, that will support Autocomplete="off". Autocomplete supported in following browsers.

  1. Chrome >= 17.0
  2. i.e. >= 5.0
  3. Firefox >= 4.0
  4. safari >= 5.2
  5. Opera >= 9.6

Learn more about AutoComplete

Upadate

When AutoComplete is not supported, you can use some workaround like this:

<input type="password" readonly onfocus="this.removeAttribute('readonly');"/>
Mox Shah
  • 2,967
  • 2
  • 26
  • 42
0

Try using autocomplete="off". Not sure if every browser supports it, though. Add this for the field in change password view.

Update:

You can try this.

$('#Password').attr("autocomplete", "off");
setTimeout('$("#Password").val("");', 2000);
Spider man
  • 3,224
  • 4
  • 30
  • 42