JavaScript parentNode: Get the parent node

Syntax:
nodeObject.parentNode
Among them, nodeObject is the node object (element node).

For example, get the parent node of the node with id="demo":

document.getElementById("demo").parentNode;

For example, get the id="demo" "The parent node of the node:

点击这里获取父节点

Please see the following demonstration:

QQ截图20161013093529.png

Continuing Learning
||
HTML DOM树型结构图
点击这里获取父节点
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!