Method is
The is method checks whether at least one of the selected elements matches the specified selector. A DOM element or a jQuery object can be specified instead of a selector. If you specify a function as a parameter, the condition checking will be assigned to it. Returns a value of the boolean type (true or false).
Syntax
The method checks whether at least one of the selected elements satisfies the given selector:
.is(selector);
The method checks whether the selected elements contain at least one element of the specified jQuery object or DOM element:
.is(jQuery object or DOM element);
This is how the given function will be called for each of the selected elements. As a parameter, it will receive the position number of the element in the set, the element itself will be available in the variable this. The function must return true or false. If at least one of the selected elements returns the value true, then is will also return true. Otherwise, the method will return false.
.is(function(index));
Example
Let's check if the div tag is a parent of our input with #test:
<div>
<input type="text" id="test">
</div>
<p>text</p>
let isDivParent = $('#test').parent().is('div');
alert(isDivParent);