title: Dynamically change thr URL of the Pin It (Pinterest) button
body: <p>I'm currently trying to add social networks's buttons to my website but I've encountered an issue with the Pin It button from Pintesrest. I'd like to dynamically change the URL of the pin but unfortunately, it seems to not working. Did I do something wrong?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var urlpin = document.location.href;
  
      function buildPinUrl(urlpin, urlmedia, description) {
         return '//pinterest.com/pin/create/button/?'+
                  'url='+encodeURIComponent(urlpin)+
                  '&amp;media='+encodeURIComponent(urlmedia)+
                  '&amp;description='+encodeURIComponent(description);
          }
  
      $(document).ready(function(){
          var urlmedia = $("#stamp1").attr("src");
          var description = $("#title").text();
          var goodurl = buildPinUrl(urlpin, urlmedia, description);
  
          $('#pinbtn').attr('href', goodurl);
  
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>And here the button:</p>
  
  <pre><code>&lt;!-- Pin It Button --&gt;&lt;a id="pinbtn" href="//pinterest.com/pin/create/button/?url=http%3A%2F%2Fcollectionnies.com&amp;media=http%3A%2F%2Fcollectionnies.com&amp;description=Next%20stop%3A%20Collectionnies" data-pin-do="buttonPin" data-pin-config="beside"&gt;&lt;img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /&gt;&lt;/a&gt;&lt;!-- Pin It Button --&gt;
  </code></pre>
  
  <p>Thanks for your help.</p>