However, .triggerHandler() is documented to only call the handler for the first element in the jQuery object. The .andSelf() adds the $ (this) to the end of the object. If you click star 3 and the click handler is this:
$(this).nextAll('a').andSelf().removeClass ('star_selected').triggerHandler('mouseout'); the elements are in the order 4 5 3 and it calls mouseout on element 4. But if the click handler is this $(this).nextAll('a').removeClass('star_selected'); $(this).removeClass('star_selected').triggerHandler('mouseout'); it calls mouseout on element 3.