Search code examples
eventsyui3

YUI3 Event Delegation for Applying Style to List Element


I know event delegation in this form:

anItem = Y.one('ul#id');
anItem.delegate('click', aFunction, 'selector');

What event to use for applying style to each li created dynamically? I will run addClass() to each li/new li.

I tried like this:

anItem.delegate('onchange', aFunction, 'selector');

I have tried with 'change' event as well. But no success.


Solution

  • What elements are selected by 'selector'? The onchange event is only valid for INPUT, SELECT and TEXTAREA elements. See the spec.