title: javascript looping through li attributes and changing values per item
body: <p>I want to loop through a bunch of <code>&lt;li&gt;</code> elements and update the value held in it, and show this on the document.</p>
  
  <p>The reason i'm doing this is because I want to sort a list of elements in an order. I do this using Sortable in JQuery.</p>
  
  <pre><code>&lt;li&gt; 1 &lt;/li&gt;
  &lt;li&gt; 2 &lt;/li&gt;
  &lt;li&gt; 3 &lt;/li&gt;
  &lt;li&gt; 4 &lt;/li&gt;
  &lt;li&gt; 5 &lt;/li&gt;
  </code></pre>
  
  <p>the order may become:</p>
  
  <pre><code>    &lt;li&gt; 3 &lt;/li&gt;
      &lt;li&gt; 1 &lt;/li&gt;
      &lt;li&gt; 4 &lt;/li&gt;
      &lt;li&gt; 2 &lt;/li&gt;
      &lt;li&gt; 5 &lt;/li&gt;
  </code></pre>
  
  <p>Then clicking a button i would like my JS function to change the value of the li items back to 1,2,3,4,5. Its worth noting i am not looking for a solution to revert back to how the list was before.</p>
  
  <p>Thanks.</p>