Open In App
Related Articles

jQuery is() Method

Improve Article
Save Article
Like Article

The is() method is used to check if one of the selected elements matches the selectorElement


$(selector).is(selectorElement, function(index, element))

Parameters: This method accepts parameters above mentioned and below described:-

  • selector: It is an optional parameter. It specifies the selector from which the event will remove.
  • selectorElement: It is a required parameter that specifies a selector expression, element, or jQuery object to match the current set of elements against. It returns true if there is at least one match from the given argument, and false if not.
  • function(index, element): It is an optional parameter that specifies a function to run for the group of selected elements.
    • index: the index position of the element
    • element: the current element (the “this” selector can also be used)

The below example illustrate the is() method in jQuery:



<!DOCTYPE html>
    <script src=
        $(document).ready(function () {
            $("p").click(function () {
                if ($("p").parent().is("div")) {
                    alert("Parent of p is div");
            <p>Click me to find out if
                I my parent is a div element.



Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 07 Jul, 2023
Like Article
Save Article
Similar Reads
Complete Tutorials