Event binding in MooTools like jQuery -


is there way assign multiple event types in mootools jquery?

mootools: $$('#id').addevents({     keyup: fn,     click: fn });  jquery: $('#id).bind('keyup click' ,fn); 

yes, there way, through powerful implement:

element.implement({     fakebind : function(evtsstr, callback){         var events = evtsstr.split(' '),              = 0,              l = events.length;         (; < l; i++){             this.addevent(events[i], callback);         }     } });  $$('div.myclass').fakebind('click mouseleave', function(event){     console.log(event.type); }); 

demo


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -