observing multiple select menus with prototype

Posted by snaken on Stack Overflow See other posts from Stack Overflow or by snaken
Published on 2010-06-08T08:32:21Z Indexed on 2010/06/08 8:32 UTC
Read the original article Hit count: 191

Filed under:
|
|

Hi,

I want to observe multiple select menus and respond to their changes using prototype but only the first menu seems to be observed. This is my code:

$('product_options').select('select').invoke("observe","change",optchange);

If there are - for example - 3 selects within product_options then it only observes the first, i thought it might be because of invoke so i then tried this:

$('product_options').select('select').each(function(sel){
    $(sel).observe("change",optchange);
});

Still doesnt work though, any ideas whats wrong?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about prototype