title: Sort html table alphabetically on page load
body: <p>I'm looking to sort a html table alphabetically on page load the same way you can sort an unordered list.</p>
  
  <p>I tried to use the code below but did not work: </p>
  
  <pre><code>    var mylist = $('#myTable');
  var listitems = mylist.children('tr').get();
  listitems.sort(function(a, b) {
     return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
  })
  $.each(listitems, function(idx, itm) { mylist.append(itm); });
  </code></pre>
  
  <p>And then </p>
  
  <pre><code>&lt;table id="myTable"&gt;
  &lt;tr&gt;
  &lt;td&gt;B&lt;/td&gt;
  &lt;td&gt;12/01/2016&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;A&lt;/td&gt;
  &lt;td&gt;12/01/2016&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I want it to sort the table alphabetically by the first column in a row.</p>
  
  <p>I can't find anything about this online.</p>