Explain through program the relationship that exists between the root and other nodes present in node-tree? - DOM
Explain through program the relationship that exists between the root and other nodes present in node-tree?
- The code that shows the relationship is as follows:
<html>
<head>
<title>DOM </title>
</head>
<body>
<h1>DOM </h1>
<p>Hello world!</p>
</body>
</html>
- <html> is the top order node and can be termed as parent node or root node for more simplification.
- Parent node is used to have the child nodes under them so the <html> consists of <head> and <body> as the child node.
- <html> consists of two child nodes and <head> or other tags consists of other child nodes like that.
- The <h1> element or <head> element or <title> element is being used for the child node and it allows the creation of more sub-nodes.