清除浏览器的jQuery通过保存的密码 [英] Clear browser saved password through jquery
问题描述
所以,在这里,我的网页修改密码,但在此之前,我已经登录页
其中用户登录并说他点击了浏览器的默认功能记住
或保存密码
或任何登录时会提示,并保存密码!
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!!
现在,当我打开我的更改密码
局部视图文本框说,ID为 txtOldPassword
将默认,而填写文本框 txtNewPassword
和 txtConfirmPassword
将空!
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!!
我打开我的 PartialView
如下,并试图清除 txtOldPassword
值!
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
});
});
不过还是值存在!现在,我并不想禁用浏览器的默认功能,但我只是想删除自动出现和密码文本商店 txtOldPassword
!
推荐答案
尝试使用自动完成=关闭。不知道是否所有的浏览器支持它,但。这种添加在更改密码的视野中。
Try using autocomplete="off". Not sure if every browser supports it, though. Add this for the field in change password view.
更新:
您可以试试这个。
$('#Password').attr("autocomplete", "off");
setTimeout('$("#Password").val("");', 2000);
这篇关于清除浏览器的jQuery通过保存的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!