Oh, awesome- didn't realize you can select multiple elements by use of commas as you can in CSS
case closed :$ On Jul 13, 7:04 pm, "Matt Stith" <[EMAIL PROTECTED]> wrote: > .add is intended to be used in the chain, in case you need something like > this: > > $("#foo").html("foobar").add("#bar").slideDown(); > > Would add "foobar" to #foo, and slide both #bar and #foo down. > > Also, you can do $("#foo,#bar") to select both. > > On 7/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > So basically, would it be practical to code the $() selector function > > in jquery to allow multiple selectors, instead of having to add them > > afterwards? > > > Current style of selecting two ID's > > 1 $("#foo") > > 2 $("#foo").add("#bar") > > 3 $("#foo","#container") > > 4 $("#foo","#container").add($("#bar","#container")) > > > Suggested Way: > > 1 $("#foo") > > 2 $(["#foo","#bar"]) aka $(array("#foo","#bar")) > > 3 $("#foo","#container") > > 4 $(["#foo","#bar"],"#container") aka $ > > (array("#foo","#bar"),"#container") > > > To make this suggestion a reality, all you would need to do is > > something like [obviously this won't work because the $ function is > > much more complicated then this, but you get the idea...] > > > function $(param1,param2){ > > if(typeof param1=="array"){ > > $.each(param1,function(x){ > > css_select(x,param2) > > }); > > } > > else > > css_select(param1,param2); > > } > > > Any reason why this isn't a possibility or unwanted?