title: Dynamic Facebook comment counter link
body: <p>I am wanting to find the href in the series class and then replace the [PAGEURL] with the same link. I also need this to repeat the function for every .details class on the page. </p>
  
  <p>Here is the JavaScript that I am using -</p>
  
  <pre><code>$(function() {
    var links = $('.details'),
      matchExp = /\[PAGEURL\]/,
      currentURL = $('.series').attr('href');
  
    links.each(function() {
      var currentHREF = $(this).attr('href');
      if (currentHREF.match(matchExp)) {
          $(this).attr('href',currentHREF.replace(matchExp,currentURL));
      }
    });
  });
  </code></pre>
  
  <p>And here is the HTML </p>
  
  <pre><code>&lt;div class="details"&gt;
    &lt;div class="series"&gt;
      &lt;a href="MyLink.php"&gt;text&lt;/a&gt;
    &lt;/div&gt;
    &lt;fb:comments-count href=[PAGEURL]&gt;&lt;/fb:comments-count&gt;
  &lt;/div&gt;
  </code></pre>