Latest web development tutorials

jQuery is () method

jQuery HTML Methods jQuery traversal methods

Examples

If <p> parent element is <div> element, the pop-up message:

if ($ ( "p"). parent (). is ( "div")) {
alert ( "p is the parent element div");
}

try it"

Definitions and use

Whether is () method is used to view the selected element matches the selector.


grammar

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

parameter description
selectorElement have to. Selector expression, according to selector / element / jQuery object inspector set of matched elements, if there is at least one matching element, it returns true, false otherwise
function (index, element)

Optional. Select the element group specified function to be executed.

  • The index position of the element - index
  • element - the current element ( "this" selector can also be used)

jQuery HTML Methods jQuery traversal methods