Georgy Liparteliani
Georgy Liparteliani

Reputation: 403

'This' checking in Jquery

I need to check with which element does 'this' match. Is it possoble?

Smth like this:

if(this == ...) {
    alert(true);
}

Upvotes: 2

Views: 75

Answers (1)

Vigrond
Vigrond

Reputation: 8198

if($(this).is('selector')) {
    alert(true);
}

Where 'selector' is your typical jQuery selector, and it will return true if it matches.

Upvotes: 4

Related Questions