Prototype Set Event for All Elements

If you need to set click event for item collection, you can read this article.

With Jquery setting event for item collection is so easy $(‘div’).click(function(){…})
But With PrototypeJS we cannot do this.

With Invoke Method
$$(‘div’).invoke(‘observe’, ‘click’, function(e){

invoke() is useful method for solving this problem. You can solve this problem with each() as well but we do not recommend it.