The password input tag is in a div like this
<div id="passwordCell" style="display:inline;">
<input type="password" pattern="[0-9]*" name="Password" id="Password" placeholder="4 digit numeric only allowed" maxlength="4"/>
</div>
- add another input field in the
#passwordCell
div, and give it an id, for example, password_mask - hide the #Password input field
- bind a jQuery keyup event to
#password_mask
input field to make it pass its inputed value to#Password
field, and replace the inputed character in#password_mask
with *. I do this because at the end the value in #Password will be sent to server as user's password
Here's the javascript code, I used jQuery
$("#passwordCell").html('');
$("#passwordCell").append('<input type="tel" name="password_mask" id="password_mask" placeholder="4 digit numeric only allowed." maxlength="4"/>' +
'<input type="password" pattern="[0-9]*" name="Password" id="Password" placeholder="4 digit numeric only allowed" maxlength="4" data-validation-required="true" data-validation-pattern="pin not_empty"/>');
$("#password_mask").textinput();
$("#Password").textinput();
//$("#password_mask").show();
$("#Password").hide();
$("#password_mask").keyup(function() {
var inputLength = $(this).val().length;
var passwordLength = $("#Password").val().length;
if (inputLength > passwordLength) {
var inputLastChar = $(this).val().charAt(inputLength-1);
$("#Password").val($("#Password").val() + inputLastChar);
} else {
$("#Password").val($("#Password").val().substring(0, $(this).val().length));
}
var i = 0;
var maskPassword = "";
while (i < $("#password_mask").val().length) {
maskPassword += "*";
i++;
}
$("#password_mask").val(maskPassword);
});
$("#password_mask").blur(function() {
$("#Password").focus();
$("#Password").blur();
});