Custom Pinterest Pin Button

Make custom "pin it" buttons/links

HTML

<a id="pinThese" href="javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;//assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());">
  <!-- You can pin one or multiple images -->
  <img src="//placehold.it/200" title="Pinterest title" />
  <img src="//placehold.it/250" title="Custom title here" />
</a>

<!-- If you want an image instead of a link,
just put an <img> tag inside of this <a> tag. -->
<a id="clickMe">Pin on Pinterest</a>

CSS

#pinThese img {
  position: absolute;
  margin-left: -9999em;
}

#clickMe {
  cursor: pointer;
}

JavaScript

$(document).ready(function() {
  $('#clickMe').on('click', function() {
    $('#pinThese img').click();
  });
});