Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

What are nodes?

$
0
0
Hi, I recently started learning JavaScript and I am trying to learn about "nodes".

What exactly are nodes? What are their functions? From what I can grasp, nodes links elements together or change them.

I've been trying to learn by using w3schools.com js tutorials and the tutorial i'm on right now has the example of this code:

<!DOCTYPE html>
<html>
<body>

<div id="div1">
<p id="p1">This is a paragraph.</p>
<p id="p2">This is another paragraph.</p>
</div>

<script>
var para=document.createElement("p");
var node=document.createTextNode("This is new.");
para.appendChild(node);

var element=document.getElementById("div1");
element.appendChild(para);
</script>

</body>
</html>


With a result of:
This is a paragraph.
This is another paragraph.
This is new.



Help would be greatly appreciated!

Viewing all articles
Browse latest Browse all 2703

Trending Articles