The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Change all elements BUT the one clicked Jquery.
I have 10 divs. I want all to change color onclick BUT the one clicked. I know i can select all elements like this
$(“*”).css(“background-color”,”red”);
They all change colors but i want the one that is clicked to remain the same.
Something like this: http://codepen.io/anon/pen/shlrb
And do not ever use `*` to select items (this select EVERYTHING). With JavaScript you want to be really specific.
Free jQuery course: https://tutsplus.com/course/30-days-to-learn-jquery/
Works perfectly, Thank you.
`$(‘.it’).not($(this))` is the same as `$(‘.it’).not(this)` (the function accepts a DOM Element as well)