Capture an Enter Key Pressed anywhere on the page

前端 未结 2 591
粉色の甜心
粉色の甜心 2020-12-08 01:39

I need to capture an Enter Key press at any time anywhere on a logon page. It will initiate a logon attempt.

Using jQuery, how would I accomplish this? And would I l

2条回答
  •  鱼传尺愫
    2020-12-08 02:13

    $(document).keypress(function(e) {
      if(e.which == 13) {
        // enter pressed
      }
    });
    

提交回复
热议问题