jQuery vs单击方法 [英] jquery on vs click methods

查看:54
本文介绍了jQuery vs单击方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 on 方法应该替换livedelegate等.但是在您当前正在使用 click 事件?例如,对于不是动态生成的元素.

I know that the on method, is supposed to replace live, delegate etc. But is there any point in using it on places where you're currently using the click event? For example on elements that are not dynamically generated.

推荐答案

并不特别值得替换click(),因为在jQuery源中,它会转换所有快捷方式"事件处理程序(例如click()keyup()等) .)还是on("event", fn).

It's not specifically worth replacing click(), as in the jQuery source it converts all the 'shortcut' event handlers (like click(), keyup() etc.) to on("event", fn) anyway.

这篇关于jQuery vs单击方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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