Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
HTML
<span class="likebtn-wrapper"></span>
(function(d,e,s){if(d.getElementById("likebtn_wjs"))return;a=d.createElement(e);m=d.getElementsByTagName(e)[0];a.async=1;a.id="likebtn_wjs";a.src=s;m.parentNode.insertBefore(a, m)})(document,"script","//w.likebtn.com/js/w/widget.js");


Where should I put this code? Should any of it be split up?

What I have tried:

I've copied and pasted the code, but when I put it at the end where I want it, it doesn't show up.
Posted
Updated 13-Sep-18 17:33pm
v2
Comments
Bryian Tan 13-Sep-18 22:34pm    
look good. assuming the function is wrapped inside the script. any error?

1 solution

Check this out : Like Button code generator - LikeBtn[^]
For example:
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
</head>
<body>

<h1>Do you like me?</h1>

<span class="likebtn-wrapper" data-identifier="item_1"></span>
<script>(function(d,e,s){if(d.getElementById("likebtn_wjs"))return;a=d.createElement(e);m=d.getElementsByTagName(e)[0];a.async=1;a.id="likebtn_wjs";a.src=s;m.parentNode.insertBefore(a, m)})(document,"script","//w.likebtn.com/js/w/widget.js");</script>

<p>Say again?</p>

</body>
</html>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900