Max*_*ain 19 javascript jquery autocomplete
我有这个代码:
html:
<input id="register_username" type="text">
<input id="register_password" type="text">
<input id="register_repeatpassword" type="text">
<input id="register_email" type="text">
Run Code Online (Sandbox Code Playgroud)
Jquery:
$(document).ready(function(){
$('#register_username').attr('autocomplete','off');
$('#register_password').attr('autocomplete','off');
$('#register_repeatpassword').attr('autocomplete','off');
$('#register_email').attr('autocomplete','off');
});
Run Code Online (Sandbox Code Playgroud)
我想禁用某些浏览器的自动完成功能,并且实际上让用户键入整个字段但代码不起作用,下拉菜单仍然出现,用户仍然可以选择之前键入的内容.我也尝试过用户,autocomplete="off"
但什么都没发生.我在这做错了什么?
Dav*_*ing 30
只需添加:
autocomplete="off"
Run Code Online (Sandbox Code Playgroud)
作为INPUT
元素的属性,f.ex:
<input autocomplete="off" id="register_username" type="text" name="username">
Run Code Online (Sandbox Code Playgroud)
Car*_*ith 12
在jQuery的版本:
$("#register_username").attr("autocomplete", "off");
Run Code Online (Sandbox Code Playgroud)
Jar*_*red 11
如果有人来这里寻找如何关闭 jquery 自动完成功能:
$("#elementId").autocomplete({
disabled: true
});
Run Code Online (Sandbox Code Playgroud)
检查这个捣鼓出
document.getElementById("register_username").autocomplete="off"
Run Code Online (Sandbox Code Playgroud)
现在,您需要将“off”更改为另一个随机字符串,例如“nope”:
jQuery:
$("#register_username").attr("autocomplete", "nope");
Run Code Online (Sandbox Code Playgroud)
HTML:
<input id="register_username" type="text" autocomplete="nope">
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
64195 次 |
最近记录: |