开发者

How to send enter key for logIn

开发者 https://www.devze.com 2023-03-19 18:39 出处:网络
How to send Enter key for logIn in MVC, when I have the following <a id=\"loginLink\" href=\"#\">login开发者_JAVA百科</a>I do recommend not to use a link in the place of a submit button! B

How to send Enter key for logIn in MVC, when I have the following <a id="loginLink" href="#">login开发者_JAVA百科</a>


I do recommend not to use a link in the place of a submit button! But if you insist, you can include this jquery that will handle the enter event for you

$('body').keyup(function(e) {
   if (0 != $('#loginLink').length && e.which == 13) {
      //document.getElementById('formId').submit()
   }
});
0

精彩评论

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