0
$('body:not(selector)').fadeTo(100,0.3);

how can we do this selection's opencity like 0.3; i am using this not working right now

$('body:not(".myCLASS")').fadeTo(400,0.1);
Adriano Carneiro
  • 57,693
  • 12
  • 90
  • 123
user1404602
  • 55
  • 1
  • 6

3 Answers3

1

Not sure what you mean with "how can we do this selection's opencity like 0.3" but I'll add my 5 cents fixing the selector

$('body :not(.myCLASS)')

Body element doesn't make a lot of sense here. You could use better container like a div or just remove body from there.

$(':not(.myCLASS)')

If you happen to have a container to restric the search, you could do

$('#myContainerId :not(.myCLASS)')
Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
1

To apply the :not() selector to all elements, do not specify body:

$(":not(.myCLASS)").fadeTo(100, 0.3);

However, it would be more efficient to only match the top-level elements you want to fade instead of all of them (fading an ancestor element will affect its descendants). Maybe something like:

$("div:not(.myCLASS)").fadeTo(100, 0.3);
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
0

This is the working code:

$('body :not(.myCLASS)').fadeTo(400,0.1);

Update

Just updated the call, check the fiddle here: http://jsfiddle.net/mHVA5/

Adriano Carneiro
  • 57,693
  • 12
  • 90
  • 123
  • $('body:not(.myCLASS)').fadeTo(400,0.1); THis isint working

    – user1404602 Sep 25 '12 at 18:13
  • 1
    The quotes end up being not relevant here, even though IMO they should be: http://stackoverflow.com/questions/12475595/why-do-the-not-and-has-selectors-allow-quoted-arguments – BoltClock Sep 25 '12 at 18:18