javascript - How can I delete the n-th element in a list with javascsript -


I know how to delete all the elements from a list. I do not know how to delete just one item. Suppose I want to delete the 3rd item list

  • An unchanged list To say I have the following:
      & lt; Ul id = "parent" & gt; & Lt; Li & gt; & Lt; Label & gt; This fist is the item & lt; / Label & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; This is the second item & lt; / Label & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; This is the third item & lt; / Label & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; This is the fourth item & lt; / Label & gt; & Lt; / Li & gt; & Lt; / Ul & gt;   

    The building I build my Christian to remove the fist of the child or the last child becomes dynamic and it would be good if I can remove n-th child. It would be good if I could do something like a document. GetElementById ("someElemet"). Delete

      var ul = document.getElementById ('guardian'); Var Leito Cal = Ul. Chilandod [2]; LiToKill.parentNode.removeChild (liToKill); // or ul.removeChild (...)    

  • Comments