Prototype Multi-Event Observation for Multi-Elements
Posted
by Phonethics
on Stack Overflow
See other posts from Stack Overflow
or by Phonethics
Published on 2010-04-07T11:54:25Z
Indexed on
2010/04/07
14:13 UTC
Read the original article
Hit count: 507
prototype
|prototypejs
['element1','element2','element3'].each(function(e){
Event.observe(e, 'click', function(event){ ... });
Event.observe(e, 'blur', function(event){ ... });
Event.observe(e, 'mousedown', function(event){ ... });
Event.observe(e, 'mouseover', function(event){ ... });
});
Is there a way to reduce this so that I can do
['element1','element2','element3'].each(function(e){
Event.observe(e, ev, function(event){
switch(e){
switch (ev)
}
});
});
?
© Stack Overflow or respective owner