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); });
Comments
Post a Comment