title: jQuery - If URL matches href then move LI to top of UL?
body: <p>Been trying to get this to work unsuccessfuly. Any help would be appreciated.</p>
  
  <p>Search UL, if any href are equal to the current URL then move it's list item to the top of the UL list stack.</p>
  
  <pre><code>var url = window.location.toString();
  
  $('#partnerCharities li.panel h1 a').each(function(){
     var myHref= $(this).attr('href');
     if( url.match( myHref)) {
          $(this).parent().parent().parent().before("#slider1 li:first");
     }
  });
  </code></pre>
  
  <p>It's a dynamically created list (image gallery), so not sure if that's why the jQuery isn't working? This is the rough layout you see in Firebug...</p>
  
  <pre><code>&lt;ul id="slider"&gt;
   &lt;li class="panel cloned"&gt;&lt;/li&gt;
   &lt;li class="panel"&gt;
    &lt;article&gt;
     &lt;h1&gt;&lt;a href="site.com"&gt;Example&lt;/a&gt;&lt;/h1&gt;
    &lt;/article&gt;
   &lt;/li&gt;
   &lt;li class="panel cloned"&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>