To add some info that helped me today, a jQuery object/this
can also be passed in to the .not() selector.
$(document).ready(function(){_x000D_
$(".navitem").click(function(){_x000D_
$(".navitem").removeClass("active");_x000D_
$(".navitem").not($(this)).addClass("active");_x000D_
});_x000D_
});
_x000D_
.navitem_x000D_
{_x000D_
width: 100px;_x000D_
background: red;_x000D_
color: white;_x000D_
display: inline-block;_x000D_
position: relative;_x000D_
text-align: center;_x000D_
}_x000D_
.navitem.active_x000D_
{_x000D_
background:green;_x000D_
}
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
_x000D_
<div class="navitem">Home</div>_x000D_
<div class="navitem">About</div>_x000D_
<div class="navitem">Pricing</div>
_x000D_
The above example can be simplified, but wanted to show the usage of this
in the not()
selector.