This is my view.
<div class="login-card">
<h1>Log-in</h1>
<br>
<input type="text" id="txtUser" placeholder="Username" autofocus value="adm">
<input type="password" id="txtPass" placeholder="Password" value="adm">
<input type="button" name="btnLogin" class="login login-submit" value="Login" onclick="btnLoginClick($('#txtUser').val(), $('#txtPass').val())">
</div>
@globalHelper.CreateDivForModalDialog("divLoginError", "Error", "Login Failed ! Try again")
This is my script.
$(document).ready(function () {
$('#divLoginError').hide();
})
function btnLoginClick(username, password) {
$.ajax({
url: "/Home/ValidateLogin",
data: { username: username, password: password },
dataType: "json",
success: function (data) {
var dialogError = $("#divLoginError").dialog({
modal: true,
autoOpen: false,
position: { my: "center", at: "center center", of: window },
height: dialogSize.getHeight(25),
width: dialogSize.getWidth(25),
overflow: scroll
});
if (data.toString() == 'true') {
window.location.href = "/Home/FWMenu";
}
else {
dialogError.dialog("open");
$('#txtUser').focus();
}
},
error: function (e) {
alert('error');
}
});
}
Problem is on login failed when the error message dailog box is coming, its showing with the blinking cursor,the cursor which is blinking behind the dailog box in the username textarea. Why it is happening and how to solve it? Below is the two screen shots.
Now look this is the cursor where it is blinking actually.