Prototype css selectors and observe

October 9th, 2008 § 0

When using $$ in Prototype, the result is an array. You need to loop through the array to attach the observe function. Expl.
$$(’.myitems‘).each(function(item) { item.observe(’click’,function(){alert (’clicked’)});});

or

$$(’.myitems’).invoke(’observe’, ‘click’, function() {alert(’clicked’)});

Related posts:

  1. Prototype: submit multiple select with ajax call

Tagged: ,

§ Leave a Reply

What's this?

You are currently reading Prototype css selectors and observe at westworld: a webmasters best friend.

meta