Hello. I'm a beginner at jQuery and I'm trying to insert a Facebook like button through the jQuery document.ready function.
My external Javascript file (loaded after the jQuery script) has the following code:
$(document).ready(function(){
if ($('#fb_btn').length) {
var fb_code = "";
fb_code += "<iframe src=\"http://www.facebook.com/plugins/like.php?href=" + escape(document.URL) +"&layout=standard&show_faces=false&width=450&action=like&colorscheme=light&height=80\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:80px;\" allowTransparency=\"true\" >";
$('#fb_btn').prepend(fb_code);
}
});
My HTML code for where I want the button is
<span id="fb_btn"></span>
Currently, nothing seems to load into the span
.
I'm trying to use this instead of inserting the code directly because inserting directly slows down the page down a bit too much.
Thanks.