title: DOM traversal one by one node using jquery
body: <p>I wanted to traverse node by node on a web page by maintaining sequence.</p>
  
  <p>e.g. Below is basic DOM :</p>
  
  <pre><code>&lt;BODY&gt;
       &lt;DIV id ='1'&gt; Test 1 &lt;/DIV&gt;
       &lt;DIV id='2'&gt; Details about &lt;SPAN id='3'&gt; Execution &lt;/SPAN&gt; &lt;/DIV&gt;   
  &lt;/BODY&gt;
  </code></pre>
  
  <p>As per above example I want traverse each node by node i.e.</p>
  
  <pre><code>1st Traversal : &lt;BODY&gt;
  
  2nd Traversal : &lt;DIV id ='1'&gt;
  
  3rd Traversal : &lt;DIV id='2'&gt;
  
  4rd Traversal : &lt;SPAN id='3'&gt;
  </code></pre>
  
  <p>My motive is to loop over all the nodes available on current page and visit each node one by one saying simply nextnode(), while traversing not looking in to parent and child relations. Exepcted is, it should visit each node by following sequence.</p>
  
  <p>So my statement will be like this :</p>
  
  <pre><code>startnode //consider this is start node
  
  While ( startnode!=null ) {
  
    // will process on startnode
  
     startnode= startnode-&gt;nextnode();
    // something like that to visit each node
  }
  </code></pre>
  
  <p>Is any one knows about this, how to achieve this using jquery(preferably) or javascript,
  please share their references.</p>
  
  <p>Thanks</p>
  
  <p>-Pravin</p>