Posted By

ianmonge on 09/13/08


Tagged

javascript array function shortcut mootools each


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

SpinZ
stephenns


Element Collection Manipulation Shortcut Using MooTools 1.2


 / Published in: JavaScript
 

URL: http://davidwalsh.name/element-collection-manipulation-shortcut-using-mootools

  1. // MooTools Looping Example (Bad/Long)
  2.  
  3. $$('.toggler').each(function(el) {
  4. el.addEvent('mouseenter',function(e) {
  5. el.fireEvent('click');
  6. });
  7. });
  8.  
  9.  
  10.  
  11. // MooTools Collection Example (Good/Short)
  12.  
  13. $$('.toggler').addEvent('mouseenter', function() { this.fireEvent('click'); });

Report this snippet  

You need to login to post a comment.