title: Not being able to sort my html list on jQuery
body: <p>I've been working on a simple code that would detect how many clicks an item has received and it would put it on the top of the list, the problem is, I can only replace the first item once, if I clicked on it again it's doesn't add up the number of clicks inside of the items. Why is this?</p>
  
  <p><strong><em>My code:</strong> (Ctrl + Shift + I) and inspect the <code>items</code> to see them change</em></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() {
    $('.watchMe &gt; .item').attr({
      "influence": "0"
    });
  });
  $('.watchMe &gt; .item').mousedown(function() {
    $(this).attr({
      "influence": parseInt($(this).attr("influence"), 10) + 1
    });
  });
  $(document).on('mouseup', function(e) {
    rearrangeEm();
  });
  
  function rearrangeEm() {
    var tempArray = [];
    $('.watchMe &gt; .item').each(function() {
      tempArray.push([this, parseInt($(this).attr("influence"), 10)]);
      console.log(this);
    });
    for (var i = 0; i &lt; tempArray.length; i++) {
      for (var j = i + 1; j &lt; tempArray.length; j++) {
        var temp;
        if (tempArray[i][1] &lt; tempArray[j][1]) {
          temp = tempArray[i];
          tempArray[i] = tempArray[j];
          tempArray[j] = temp;
        }
      }
    }
    $('.watchMe').empty();
    for (i = 0; i &lt; tempArray.length; i++) {
      $('.watchMe').append(tempArray[i][0]);
    }
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
    &lt;title&gt;smartSystem&lt;/title&gt;
    &lt;style&gt;
      .item {
        height: 100px;
        border: 1px solid #c3c3c3;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div class="watchMe"&gt;
      &lt;div class="item"&gt;a&lt;/div&gt;
      &lt;div class="item"&gt;b&lt;/div&gt;
      &lt;div class="item"&gt;c&lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>