开发者

What is a good yui replacement for jquery.live

开发者 https://www.devze.com 2022-12-10 22:48 出处:网络
jQuery.live 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.

jQuery.live

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开发者_Go百科://docs.jquery.com/Events/live

Is there a good YUI replacement which can do this?


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 has delegate functionality as well, but the syntax is slightly different.

0

精彩评论

暂无评论...
验证码 换一张
取 消