# jQuery.contains()

Categories: Utilities

## jQuery.contains( container, contained ) Returns: Boolean

Description: Check to see if a DOM element is within another DOM element.

- #### version added: 1.4jQuery.contains( container, contained )

  containerThe DOM element that may contain the other element.

  containedThe DOM element that may be contained by the other element.

### Example:

#### Check if an element is inside another. Text and comment nodes are not supported.

    jQuery.contains(document.documentElement, document.body); // true
    jQuery.contains(document.body, document.documentElement); // false