微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Call function on mouse click or Enter keypress

程序名称:Call function on mouse click or Enter keypress

授权协议: 未知

操作系统: 未知

开发语言:

Call function on mouse click or Enter keypress 介绍

Typically useful on anchor elements for which following the link should
produce javascript functionality instead of the default action (following the
URL).

Function binds mouse click and enter keypress to a specified element, and
calls the specified function. The default action (e.g. following the href for
an anchor) is prevented.

Release 1.2+ supports binding to more than one element, because the callback
function is aware of the target of the click / enter keypress.

Usage:

$.clickOrEnter(yourElement,yourFunction);

e.g.

$.clickOrEnter('a',popup);

This essentially replaces the style of

<a href="javascript:function();">Foo</a> <a href="foo.html" onclick="function();" onkeypress="function();">Bar</a>

which are inaccessible / obtrusive.

Call function on mouse click or Enter keypress 官网

http://plugins.jquery.com/project/clickOrEnter

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐