title: Sorting list in a page and it's child page
body: <p>I have javascript that is finding the current page url and sorting a list on it. The same list is found on a child page. For example the parent page is Criminal Law, but it also has multiple children pages: Assault, Menacing, Domestic Violence, and so on. The child pages are not getting the list sorted alphabetically and I really have no idea how to do it. I was hoping I could get some ideas of how to do this. I'm still pretty new at javascript.</p>
  
  <pre><code>var currentPage = document.URL;
      if (currentPage == "http://www.jbplegal.com/criminal-law/") {
  
  var items = $('#gb-simple-page-hierarchy-5 ul li').get();
  items.sort(function(a,b){
    var keyA = $(a).text();
    var keyB = $(b).text();
  
    if (keyA &lt; keyB) return -1;
    if (keyA &gt; keyB) return 1;
    return 0;
  });
  </code></pre>
  
  <p>HTML Unordered List Code</p>
  
  <pre><code>&lt;aside id="gb-simple-page-hierarchy-5" class="widget gb-page-hierarchy-widget"&gt;&lt;h1 class="widget-title"&gt;&lt;a href="http://www.jbplegal.com/criminal-law/"&gt;Criminal Defense Attorneys&lt;/a&gt;&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/assault-and-menacing/"&gt;Assault and Menacing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/felonies/"&gt;Charged with Felonies&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/child-abuse-child-endangerment/"&gt;Colorado Child Abuse&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/controlled-substances/"&gt;Controlled Substances&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/criminal-mischief/"&gt;Criminal Mischief&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/criminal-record-sealing/"&gt;Criminal Record Sealing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/domestic-violence/"&gt;Domestic Violence&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/failure-to-appear/"&gt;Failure to Appear&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/felony-drug-charges/"&gt;Felony Drug Charges&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/harassment/"&gt;Harassment&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/juvenile-delinquency/"&gt;Juvenile Delinquency&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/marijuana-related-offenses/"&gt;Marijuana-Related Offenses&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/minor-in-possession/"&gt;Minor In Possession&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/misdemeanor-charges/"&gt;Misdemeanor Charges&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/protection-orders/"&gt;Protection Orders&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/sex-offenses/"&gt;Sex Offenses&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/theft-charges/"&gt;Theft Charges&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jbplegal.com/criminal-law/trespass/"&gt;Trespass&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/aside&gt;
  </code></pre>