Hi,
The $$ function returns an array[1]. Arrays don't have an `observe`
method. However, Prototype does add an `invoke` method[2] to arrays by
mixing the Enumerable mix-in into them. So:
$$('input.compare_itm').invoke('observe', 'click', myFunction);
That said, you'll end up hooking the event
Indeed T.J. catching bubbling events is something I need to consider more
often.
Thanks for the heads up :-)
On Mon, Aug 23, 2010 at 10:05 AM, T.J. Crowder t...@crowdersoftware.comwrote:
Hi,
The $$ function returns an array[1]. Arrays don't have an `observe`
method. However, Prototype does
thanks, it works !
Another question: how can I send element as argument to the click
function ?
I'm trying to use this:
$$('input.compare_itm').invoke('observe', 'click',
myFunction.bindAsEventListener('compare', this ));
function myFunction(group, elm){
alert(elm.value); // undefined
}
On Aug
Hi,
Another question: how can I send element as argument to the click
function ?
If you're using `observe`, Prototype ensures that within the event
handler, `this` refers to the element on which you called `observe`.
If you're using `on`, then the element will be the second argument to
your