I figured out a work around for this issue and that is password masking using JQuery.
Hint: password suggestion and form filling will only happen if the type of input box is a password.
So the solution I approach is as follow,
01). Make the input field type=“text”
<input type="text" />
02). Mask the input characters with ‘•’
var actualPassword = [],
temperoryPassword,
currentCursorPosition = 0,
passwordChar = '•';
$("#password-text").bind("input", function () {
temperoryPassword = $(this).val();
var passwordLength = temperoryPassword.length;
for (var i = 0; i < passwordLength; i++) {
if (temperoryPassword[i] != passwordChar) {
actualPassword[i] = temperoryPassword[i];
}
}
// Get current cursor position.
currentCursorPosition = this.selectionStart;
$(this).val(temperoryPassword.replace(/./g, passwordChar));
});
$("#password-text").bind("keyup", function () {
var passwordLength = $(this).val().length;
if (passwordLength < actualPassword.length) {
var difference = actualPassword.length - passwordLength,
key = event.keyCode || event.charCode;
// Check if last keypress was backspace or delete
if (key == 8 || key == 46) {
actualPassword.splice(currentCursorPosition, difference);
}
// User highlighted and overwrite part of the password
else {
actualPassword.splice(currentCursorPosition - 1, difference + 1);
actualPassword.splice(currentCursorPosition - 1, 0, temperoryPassword[currentCursorPosition - 1]);
}
}
});
$("#btnSubmit").click(function(){
$("#passwordTxt").text(bindactualPassword(actualPassword));
});
// disable password cut, copy and paste function in password field
$('#password-text').bind("cut copy paste",function(e) {
e.preventDefault();
});
function bindactualPassword(){
return actualPassword.join("");
}
I written a medium article on this case. You can read it here as well,
https://medium.com/@shamique/programatically-prevent-password-suggestion-and-auto-fill-in-browsers-6661537a3e46
Hope this will useful to others :)