Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to have multiple like buttons on a page so as a test I have made a content editor web part with the following script. It basically has two links that like two different pages in the site. The problem is that when i click on the two links one after the other, only the link that gets clicked first registers the like. I verify this by the using the default 'Tag and Notes' button on the 2 pages which display 'i like it' if the like has been registered. Does anybody have an idea why both the likes dont get registered?

<script type="text/ecmascript">

    function AddCompanyQuickTag1(itemurl) {
    SafeRunFunction(function () {
    var o = new SocialQuickTag("link1");
    o.url = itemurl;
    o.title = document.title;
    o.tagged_text = 'Add Tag...';
    o.failure_text = 'Failed tagging this page.';
    o.AddQuickTag(0);
    }, 'SocialData.js', 'SocialQuickTag');
    }
function AddCompanyQuickTag2(itemurl) {
    SafeRunFunction(function () {
    var o = new SocialQuickTag("link2");
    o.url = itemurl;
    o.title = document.title;
    o.tagged_text = 'Add Tag...';
    o.failure_text = 'Failed tagging this page.';
    o.AddQuickTag(0);
    }, 'SocialData.js', 'SocialQuickTag');
    }

    </script>
    <div>
        <a id="link1" onclick="AddCompanyQuickTag1('http://indevpc263/sites/TeamSite/SiteAssets/flash.aspx')">
            <img src="/_layouts/images/socialbutton-like.png" alt=""/> 
        </a>    &#160;&#160; 
        <a id="link2" onclick="AddCompanyQuickTag2('http://indevpc263/sites/TeamSite/SiteAssets/social.aspx')">
            <img src="/_layouts/images/socialbutton-like.png" alt=""/> 
        </a>
    </div>
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.