什么是jquery.live的优秀yui替代品 [英] What is a good yui replacement for jquery.live

查看:58
本文介绍了什么是jquery.live的优秀yui替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery.live

jQuery.live

在jQuery 1.3中添加:将处理程序绑定到所有当前和未来匹配元素的事件(如单击)。也可以绑定自定义事件。

Added in jQuery 1.3: Binds a handler to an event (like click) for all current - and future - matched element. Can also bind custom events.

http:/ /docs.jquery.com/Events/live

是否有一个好的YUI替换可以做到这一点?

Is there a good YUI replacement which can do this?

推荐答案

在YUI3中,代表们执行此功能。以下代码段将在正文中的任何p标记上触发一个名为clickHandler的方法。

In YUI3, delegates perform this function. The following snippet will fire a method called "clickHandler" on any 'p' tag in the body.

YUI().use('event', function(Y) {
  Y.delegate("click", clickHandler, "body", "p");
});

YUI 2.8.0有委托功能,但语法略有不同。

YUI 2.8.0 has delegate functionality as well, but the syntax is slightly different.

这篇关于什么是jquery.live的优秀yui替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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