3

I'm trying to exclude two cases in my CSS selector. Currently the selector looks like this:

$$('select:not([class=session])').each(function(){
    //blah blah
})

But i want to exclude another class named "sessionproperties"

Is there any way to exclude more than one in a single selector statement? Any help on this is appreciated.

note: I've tried using the ~= operator for the word "session" but it totally does not work for me.

Madison Williams
  • 350
  • 1
  • 4
  • 11

2 Answers2

6

I don't know why you need the class attribute, that is what a . selector is for. You can comma separate sub selectors in the :not just like you can when you define them in your stylesheet.

$$('select:not(.session, .sessionproperties)').each(function() {
 ...
})
Hemlock
  • 6,130
  • 1
  • 27
  • 37
  • lol, so prototype does the same as jQuery. Should have checked that better. =) +1 – Marnix Jan 17 '11 at 19:12
  • @Madison Yep, I'm confident that they all just leverage `document.querySelectorAll` at this point so they'd have to match the w2c specifications. – Hemlock Jan 17 '11 at 20:24
0

Prototype supports CSS3 syntax selectors,

So why not try the comma?

$$('select:not([class=session]), select:not([class=sessionproperties]').each(function(){
    //blah blah
})
Marnix
  • 6,384
  • 4
  • 43
  • 78
  • I tried that before I posted this as well. For some reason it breaks the first not() statement as well and just selects all of the – Madison Williams Jan 17 '11 at 19:09
  • i think the OP wanted to remove the union of the two groups, your selection removes the intersection – davin Jan 17 '11 at 19:11
  • hehe. tell all the cs kids in college that its practical and theyll laugh, although here we are – davin Jan 17 '11 at 19:15