title: How to get the current ul li's length in javascript , when i tried to sort them?
body: <pre><code>&lt;ul id="types" style="list-type:none;"&gt;
  
  &lt;li id="categories" style="list-type:none;"&gt;1
  &lt;ul&gt;
      &lt;li style="list-type:none;"&gt;1&lt;/li&gt;&lt;br/&gt;
      &lt;li style="list-type:none;"&gt;1&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
  
  &lt;li id="categories" style="list-type:none;"&gt;2
  &lt;ul&gt;
      &lt;li style="list-type:none;"&gt;2&lt;/li&gt;&lt;br/&gt;
      &lt;li style="list-type:none;"&gt;2&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
  
  &lt;li id="categories" style="list-type:none;"&gt;3
  &lt;ul&gt;
      &lt;li style="list-type:none;"&gt;3&lt;/li&gt;&lt;br/&gt;
      &lt;li style="list-type:none;"&gt;3&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
  
  &lt;/ul&gt;
  </code></pre>
  
  <p>i am moving the li up and down ,when i am doing like this i have written the code for calling one jquery _mouseStop function(event,noPropagation)) </p>
  
  <p>in this function i am writing </p>
  
  <pre><code>var tagetNode = this.currentItem[0].parentNode.id
  
  if (this.element[0].id == "categories") {
      var targetlistlength = document.getElementById(targetListId).getElementsByTagName("li").length;
      // var targetlistlength = this.parentNode.getElementsByTagName("li").length;
      var PageIds = "";
      for (var i = 0; i &lt; targetlistlength; i++) {
          PageIds += document.getElementById(targetListId).getElementsByTagName("li")[i].getAttribute("value") + ",";
      }
  
  }
  </code></pre>
  
  <p>when i am sorting the child li's the above function get called but it is always getting the first child ul of first li length only.. i want the current ul li's length which i am trying to sort</p>
  
  <p>i have tried with the commented line also to get the length of li's but iam getting error as this.parentNode is undefined</p>
  
  <p>anyone  please suggest me what can i do</p>