I am using a jQuery click function and would like to know if I can use the term ‘this’ to select the nav element and another selector at the same here’s my code:
$('#nav').click(function() {
$(this, '#anotherSelector').hide();
});
This doesn’t work. It selects the #anotherSelector and not the #nav element as well. What am I doing wrong?
Many thanks in advance.
Use
.add()to add another selector into your set of elements you want to deal with, like this: