Tutorials References Exercises Bootcamps Videos Menu
Sign Up Create Website Get Certified Upgrade

jQuery is() Method

❮ jQuery Traversing Methods


If the parent of <p> is a <div> element, alert some text:

if ($("p").parent().is("div")) {
  alert("Parent of p is div");
Try it Yourself »

Definition and Usage

The is() method checks if one of the selected elements matches the selectorElement.



Parameter Description
selectorElement Required. Specifies a selector expression, element or a jQuery object to match the current set of elements against. Returns true if there is at least one match from the given argument, and false if not.

Optional. 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)

❮ jQuery Traversing Methods