我如何知道是否按下了Enter键或鼠标单击鼠标按钮 [英] How do I know whether I pressed Enter Key or Mouse Click for a HTML button

查看:92
本文介绍了我如何知道是否按下了Enter键或鼠标单击鼠标按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个表格并且我有一个按钮。

如果我想提交表格,我必须点击按钮。

这里,我可以专注于那个按钮并按Enter键或使用鼠标直接点击该按钮。

我的问题是如何知道我是按下Enter键还是鼠标点击

解决方案

这里,您的演示问题的一个很好的解释;)



http://stackoverflow.com/questions/7394796/jquery- click-event-how-to-tell-if-mouse-was-clicked-or-enter-key-was-pressed [ ^ ]

Suppose if I have a form and in that I have a button.
If I want to submit a form I have to click on the button.
Here, I may focus on to that button and hit Enter Key or directly click on that button using mouse.
My Question is how do I know whether I pressed Enter Key or Mouse click

解决方案

here ,A good explanation for your Question with Demo ;)

http://stackoverflow.com/questions/7394796/jquery-click-event-how-to-tell-if-mouse-was-clicked-or-enter-key-was-pressed[^]


这篇关于我如何知道是否按下了Enter键或鼠标单击鼠标按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆