It has how to set focus to the element?
HasFocus know there's more I would have to declare another variable just that this screen will still be more un 15 objects and not like to declare many variables
There is a possibility I set this?A snippet of codeHTML
<div>
<input type="text" id="email_log" maxlength="50" data-bind="value: email_log" name="email_log">
<input type="password" id="password_log" maxlength="10" data-bind="value: senha_log" name="password_log">
<button id="btn_login" data-bind="click: login" >
<span class="label">OK</span>
</button>
</div>
JAVASCRIPT
function LoginViewModel() {
this.email_log = ko.observable();
this.password_log = ko.observable();
this.login= function () {
if (isNullOrWhiteSpace(this.email_log()))
{
//to set focus on element here
alert("Enter the e-mail");
return false;
}
jQuery.ajax({
url: '/Home/',
cache: false,
type: 'POST',
contentType: 'application/json;charset=utf-8',
data: '{"email": "' + this.email_log() + '","password": "' + this.password_log() + '"}',
success: function (data) {
}
}).fail(function (h, t, e) {
alert(e);
});
};
}