I have 10 divs. I want all to change color onclick BUT the one clicked. I know i can select all elements like this
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
Free jQuery course: https://tutsplus.com/course/30-days-to-learn-jquery/
This reply has been reported for inappropriate content.
$('.it').not($(this)) will give all matched items except the one clicked. However, in this instance I would do exactly what @AlenAbdula has posted.
Works perfectly, Thank you.
`$(‘.it’).not($(this))` is the same as `$(‘.it’).not(this)` (the function accepts a DOM Element as well)
You must be logged in to reply to this topic.