how to use javascript on wordpress
-
hello there i want people to share my content to facebook and then they have access to the submit button
this is my script it works fine in html or the w3schools testmode
but its not working in wordpress
this is the whole code i wrote in text mode of a page
<!DOCTYPE html>
<html>
<body><div id=”results”>
<p>Download content is locked! Please share it & unlock the content</p>
<center>
<img onclick=”shareOnFB();” style=”cursor:pointer” src=”https://d1wofkmqsniyp0.cloudfront.net/public/v2.0/imgs/fbshare.png”>
</center>
</div><script type=”text/javascript”>
function shareOnFB() {
var e = {
method: “feed”,
link: “https://w3lessons.info”,
picture: “https://w3lessons.info/logo_large.png”,
name: “W3lessons – PHP, MYSQL, HTML5, CSS3, jQuery, Ajax, Facebook Style Scripts”,
caption: ‘w3lessons.info’,
description: “w3lessons.info is a programming blog maintained by Karthikeyan K. Tutorials focused on Programming, Jquery, Ajax, PHP,HTML5, CSS3, Web Design and MySQL”
};
FB.ui(e, function(t) {
if (t[“post_id”]) {
//your download content goes here
// Do something there
var secret_data = “<h2 class=\”stitle1\”>Thank you!</h2><h2 class=\”stitle2\”>Please use the below link to download</h2><p class=\”d_link\”>https://app.box.com/s/j23e7gxuug2ml54m09d4</p>”;
jQuery(“#results”).html(secret_data);
}
})
}</script>
<div id=”fb-root”></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=843374912383596&version=v2.0”;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script></body>
</html>any help would be appreciated please please please help
- The topic ‘how to use javascript on wordpress’ is closed to new replies.