JQuery: How to select all elements with same class besides the one clicked?

jquery, jquery-selectors

Solution

You could use `not()`:

$('div.test').click(function(){
    var notClicked =  $('.test').not(this);
});

Problem

I guess I'm looking for an opposite to $(this). If I have 3 elements with the same class how can I select only the elements I haven't clicked. EG: ``` <div class="test"></div> <div class="test"></div> <div class="test"></div> ``` And I click the middle div, how do I only implement effects on the first and last element?

Original source

Related problems