Find element that is clicked change siblings
<p>I would like to change all elements in a list except the one that is clicked. I suppose I need to determine what is actually clicked and then change it's siblings? How do I find which element is clicked?</p>

<pre><code>&lt;ul&gt;
    &lt;li&gt;&lt;h4 class="span1"&gt;&lt;a href="#" class="sort" data-sort="ID"&gt;ID&lt;i class="icon-arrow-down" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/h4&gt;&lt;/li&gt;
    &lt;li&gt;&lt;h4 class="span2"&gt;&lt;a href="#" class="sort" data-sort="Type"&gt;Type&lt;i class="icon-arrow-down" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/h4&gt;&lt;/li&gt;
    &lt;li&gt;&lt;h4 class="span3"&gt;&lt;a href="#" class="sort" data-sort="Task"&gt;Task&lt;i class="icon-arrow-down" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/h4&gt;&lt;/li&gt;
    &lt;li&gt;&lt;h4 class="span8"&gt;&lt;a href="#" class="sort" data-sort="Project"&gt;Project&lt;i class="icon-arrow-down" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/h4&gt;&lt;/li&gt;
    &lt;li&gt;&lt;h4 class="span3a"&gt;&lt;a href="#" class="sort" data-sort="DueDate"&gt;Urgency&lt;i class="icon-arrow-down" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/h4&gt;&lt;/li&gt;
    &lt;li&gt;&lt;h4 class="span3 last"&gt;&lt;a href="#" class="sort" data-sort="Created"&gt;Date Created&lt;i class="icon-arrow-down" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/h4&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<pre class="lang-js prettyprint-override"><code>$('.sort').click(function () {
    $(this).data('clicked', true);

    if($(this).data('clicked')) {
        $('i', this).toggleClass('icon-arrow-down').toggleClass('icon-arrow-up');
    } 
    else {
        $('.sort i').siblings().removeClass('icon-arrow-up').addClass('icon-arrow-down');
    }
});
</code></pre>

<hr>

<p>Answer: </p>

<pre><code>$('.sort').click(function() {
    $(this).closest('li').siblings().find('i').removeClass('icon-arrow-up').addClass('icon-arrow-down');
    $(this).find('i').toggleClass('icon-arrow-down icon-arrow-up');
});
</code></pre>
