That would return a boolean value, not the length. -- dz
On Mon, Feb 9, 2009 at 1:59 PM, Ricardo Tomasi <ricardob...@gmail.com> wrote: > > Wouldn't that be essentially the same as $("#field1, #field2").length > == 2 ? > > On Feb 9, 1:35 am, Dave Methvin <dave.meth...@gmail.com> wrote: >> > $("#field1 & #field2").length would be either 0 or 2, but never 1. >> >> How about a plugin? These are short enough they could be added to the >> core. >> >> $("#field1").and("#field2").length >> >> // If elements are selected in this jQuery object, >> // add sel to that; else empty the object. >> jQuery.fn.and = function(sel){ >> return this.length? this.add(sel) : this.pushStack([]); >> }; >> >> // If no elements are selected in this jQuery object, use >> // the ones selected by sel; else use the current ones. >> jQuery.fn.or = function(sel){ >> return this.pushStack( this.length? this : sel ); >> }; > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---