[Solved] Navigate in DOM with Javascript


The easiest way would be to use: document.getElementsByTagName("*").length

Is there something necessary like the numerical coding for node types like: 1: for element-nodes 3: for text-nodes 9: for document-nodes?

No. You could write a function which recursively loops over the children of every node (starting at the document) and testing the node type of each … but the above approach is simpler.

solved Navigate in DOM with Javascript