Yes you are correct, guess I did phrase that incorrectly. This a:not(.xyz) work perfectly. Exactly what I need, where in the mootools documentation is this? I looked all over and could not find anything about the usage of not in selectors.
On Wed, Feb 10, 2010 at 1:48 PM, Trevor Orr <[email protected]> wrote: > That is kind of what I figured I would have to do, was just hoping I was > missing something in the docs like usual. What is faster? > > $$('a').each(function(el) { > if (el.hasClass('xyz')) { > console.log(el); > } > }); > > OR > > var els = $$('a').filter(function(el, index){ > return el.hasClass('xyz'); > }); > console.log(els); > > > > > On Wed, Feb 10, 2010 at 1:27 PM, Ryan Rampersad > <[email protected]>wrote: > >> You could do something like $$("a.xyz") if you knew that the xyz class was >> on those elements. If you don't have anything else to select by, it gets >> kind of try tricky. You could do a $$("a") and then use one of the array >> methods to trim down your set, maybe Array.filter. >> >> http://mootools.net/shell/fb66S/ >> >> >> On Wed, Feb 10, 2010 at 3:10 PM, Trevor Orr <[email protected]> wrote: >> >>> Is there a way to get all tags that do not have a particular class ? >>> >>> For Example: >>> >>> <a class="abc xyz">123</a> >>> <a class="abc xyz">456</a> >>> <a class="abc">789</a> >>> >>> I only want to get the first 2 a tags. I have no control over the html, I >>> am just processing it. >>> >>> I could get all a tags and loop through them and check if it has a >>> particular class but would rather not have to if possible. >>> >>> >>> >> >> >> -- >> Ryan Rampersad >> www.ifupdown.com >> > >
