> It doesn't do the same thing. Where .each runs the tests for every > element in the collection and returns the collection, .cond() runs the > tests once and returns anything you like.
Might I then suggest a simpler and more versatile method: jQuery.fn.run = function (func, args) { this.length && func.apply(this, args||[]); return this; }, Used so: jQuery('a').run(function(){ x === 1 ? this.css({ color: 'blue' }): x === 2 ? this.css({ color: 'red' }): test() ? this.css({ color: val }): this.css({ color: 'green' }); }); this `.run()` method has become part of my standard utility toolkit. Highly efficient (only runs if the collection has length>0) and provides the collection itself as this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---