Sunday, 28 July 2013

Add a FACEBOOK like button in your website using JQuery

  Sometime we had wonder how the like button is integrated with corresponding Social Networking, if we gave like then the corresponding website like information is posted in the social network.

Now let we see how to add the like button in our website?

Get the Jquery SDK from the Facebook then add the element in DIV tag.

<html xmlns="">
<title>jQuery Implement on facebook Like button </title>
 <div id="fb-root"></div>
<script>(function (d, s, id)
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id))
    js = d.createElement(s); = id;
    js.src = "//";
    fjs.parentNode.insertBefore(js, fjs);
(document, 'script', 'facebook-jssdk'));

window.onload = function ()
  var url = window.location.protocol + "//" + window.location.hostname +
  document.getElementsByClassName ("fb-like")[0].attributes[4].nodeValue =url;
    <form id="form1" runat="server">
 <div class="fb-like" data-href="" data-send="true" data-width="250"

From this article you can see the how to add the Facebook like button in your own website.