开发者

Focus textbox onload with mvc?

开发者 https://www.devze.com 2022-12-18 02:02 出处:网络
I have a login-page and would like the \"User开发者_开发技巧name\" textbox focus when page loads.

I have a login-page and would like the "User开发者_开发技巧name" textbox focus when page loads.

How is that done best using MVC? Some script or jquery or something?

/M


<body onload="document.getElementById('myTextBox').focus();">

or in jquery

$(function() { $('#myTextbox').focus(); });


via Jquery

$(function() {
  $("#Username").focus();
});
0

精彩评论

暂无评论...
验证码 换一张
取 消