Search code examples
jqueryfacebookurldynamicshare-button

jquery facebook share button dynamic url insert


with var url = window.location.href; get i my url and now i will the url variable put in the facebook share link.

<fb:share-button href="url variable here" type="button"></fb:share-button>

how can I implement that?

Hope someone can help me.


Solution

  • Here you go!

    var url = window.location.href;
    $('fb\\:share-button').attr('href', url)
    

    Hope this helps