| Page 1 of 1 | [ 4 posts ] |
|
i want to bind a event to some a elements, and they has the same classname, so how can i use YUI3 to bind the event to these elements
YUI, Why not Use In your project?
just like jQuery .find('.classname') thank u very much |
Joe Developer
|
Y.delegate('containerselector', handlerfunction, 'target selectors');
so for example Y.delegate('#containerid', myhandler, 'a.classname'); where myhandler could be var myhandler = function(e){ var clickedOn = e.currentTarget; alert('are you sure you want to go to ' + clickedOn.get('src')); }; See these for more info: http://developer.yahoo.com/yui/3/event/ http://developer.yahoo.com/yui/theater/ ... 2009-sugar http://www.yuiblog.com/blog/2009/11/13/ ... egation-3/ http://developer.yahoo.com/yui/theater/ ... 009-events |
|
This is incorrect, the delegate method's signature is:
EventHandle delegate ( type , fn , el , spec , context , args* ) Code: Y.delegate('click', handleFn, '#container', 'a.external'); http://developer.yahoo.com/yui/3/api/YU ... d_delegate |
Joe Developer
|
Quite so, apologies
|
| Page 1 of 1 | [ 4 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group