Turnoff Auto Complete
Turn Off Autocomplete for Input type is password:
Method 1:
Method 1:
autocomplete=”off” is not valid markup with XHTML Transitional, which is a common DOCTYPE. Use this to keep a vaild markup
if (document.getElementsByTagName) {
var inputElements = document.getElementsByTagName(“input”);
for (i=0; inputElements[i]; i++) {
if (inputElements[i].className && (inputElements[i].className.indexOf(“disableAutoComplete”) != -1)) {
inputElements[i].setAttribute(“autocomplete”,”off”);
}
}
}
Method 2:
- autocomplete="false" ( Insert this in to username input field )
- autocomplete="new-password" ( Insert this in to password input field )
Method 3:
Create a temporary text box above the password field and hide it.
<input type="text" style="display:none;">
Like This:
<form method="post" autocomplete="off" action="">
<ul class="field-set">
<li>
<label>Username:</label>
<input type="text" name="acct" id="username" maxlength="100" size="20">
</li>
<li>
<label>Password:</label>
<input type="text" style="display:none;">
<input type="password" name="pswd" id="password" maxlength="16" size="20" >
</li>
</ul>
</form>
Chrome autocomplete="off"
HTML: <input type="password" id="some_id" autocomplete="new-password">
JQuery:
$(document).ready(function() {
var some_id = $('#some_id');
some_id.prop('type', 'text');
some_id.removeAttr('autocomplete');
});
HTML: <input type="password" id="some_id" autocomplete="new-password">
JQuery:
$(document).ready(function() {
var some_id = $('#some_id');
some_id.prop('type', 'text');
some_id.removeAttr('autocomplete');
});
Comments
Post a Comment