May 3, 2006
9:34 am
Event Selector Showdown : the jQuery Challenge
John posted an interesting challenge : Find all the LI elements underneath two different elements (using their #ID as reference) and bind a click handler which changes the color of the LI’s text. Here is how you would do that in all of the popular event/selector libraries. Comparing Behaviour + Prototype, Prototype 1.5.0, event:Selectors and jQuery; the result is amazing :
Behaviour + Prototype
'#otheritem li': function(element) {
Event.observe(element, 'click', function(event) {
Event.element(element).setStyle({color: '#c00'});
});
}
});
Prototype 1.5.0
event:Selectors
jQuery
Loading

Leave a comment »