jQuery - Target button with enter key when input field is focused

后端 未结 5 2060
无人共我
无人共我 2021-02-01 04:33

I have an input field and a login button. I want to allow users to hit the \"enter\" key to click the button when the input field is focused. How would I do this with jQuery?<

5条回答
  •  轮回少年
    2021-02-01 05:02

    The answer does not work when the trigger is somewhere attached in asp.net code adn not in js or jquery. What works fine is setting the focus on the button. In your case replace my named (sharepoint generated) fields with your login fields

        
    

提交回复
热议问题