jQuery中的addEventListener [英] addEventListener in jQuery

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

问题描述


可能重复:

jQuery相当于JavaScript的addEventListener方法

同样来自一个非常好的jQuery教程: http://itunes.apple.com / in / app / designmobileweb / id486198804?mt = 8

Also from a very good jQuery tutorial on : http://itunes.apple.com/in/app/designmobileweb/id486198804?mt=8

以下语句的jQuery等价物是什么;

What is the jQuery equivalent for the following statement;

element1.addEventListener('click',doSomething2,false)

如果是bind()方法,是否有任何选项来指定最后一个参数(即事件冒泡或捕获......真/假)

If it is the bind() method, is there any option to specify the last parameter (i.e. event bubbling or capturing ...true/false)

谢谢。

推荐答案

试试这个

// Setting the third argument to false will attach a function
// that prevents the default action from occurring and 
// stops the event from bubbling.
$("#element1").bind("click", doSomething2, false);

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

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