English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
contains()Returns a boolean value indicating whether the node passed in is a child node of the current node.
node.contains(node)
var p = document.getElementById("myP"); var div = document.getElementById("myDIV"); div.contains(p);Test to see‹/›
All browsers fully support the contains() method:
Method | |||||
contains() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
node | Specify the node (and its descendants) that may contain the specified node |
Return value: | A boolean value indicating whether the node is a child of the given node. Possible values:
|
---|