This question is related to this post but I don’t see how I can ask another question in the same question.
I need to know what $(this) this is. If I alert $(this) I get [object Object]. In other words when I alert($(this)) I need for the outcome to be a specific <li> tag so that I can do an IF ELSE statement when I roll off a specific link.
Thanks.
James
In a handler,
thisis the DOM element. So to get the tag, just use thetagNameproperty. Likewise, you can get other properties like ID withthis.id.Or if you needed to test against a specific selector (I wasn’t sure from your question), you can use jQuery’s
.is().(Actually, in that simple case of testing for a class, you’d probably use
.hasClass()instead.)There may be more efficient ways. Depends on what you actually need to test for.
EDIT: From your comment, you want to check if a child
<a>element has the classrpSelected.Try this: