What is a good yui replacement for jquery.live

jQuery.live

Added in jQuery 1.3: attaches a handler to an event (for example, a click) for all elements corresponding to the current and future. May also bind custom events.

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

Is there a good replacement for YUI that can do this?

+3
source share
1 answer

In YUI3, delegates perform this function. The following snippet launches 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 a delegate , but the syntax is slightly different.

+7
source

Source: https://habr.com/ru/post/1721806/


All Articles