gpt4 book ai didi

jQuery 热键插件使用绑定(bind)

转载 作者:行者123 更新时间:2023-12-01 03:17:26 24 4
gpt4 key购买 nike

我正在使用jQuery hotkeys plugin ,由 John Resig(jQuery 先生)编写。然而,它使用 bind,并且 bind 现在被 on 取代,如 the official jQuery API 中所述。 .

标准代码是:

$(document).bind('keyup', 'alt+a', function(evt){...});

我尝试将 bind 更改为 on,但没有成功。有没有解决方法,或者没有关系?

我还想知道将处理程序附加到文档是否总是最好的方法。

最佳答案

on 采用额外的 DOM 参数 http://api.jquery.com/on/ ,所以写null

尝试

$(document).on('keyup', null, 'alt+a', function(){}

关于jQuery 热键插件使用绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14036983/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com