I have a snippet to create a 'Like' button for our news site:
<iframe id="likeButton" src="http://www.facebook.com/widgets/like.php?href="
scrolling="no" frameborder="0"
style="border:none; width:450px; height:80px"></iframe>
However, to make it work properly, because the button posted an error saying the button was on an invalid URL address, I added a bit of jQuery to tweak the URL like this:
<script type="text/javascript">
$(document).ready(function(){
var imageFile = $('#likeButton').attr( 'src');
eval("imageFile = imageFile +"+"window.location.href;");
eval("$('#likeButton').attr( 'src', function(){return imageFile +"+"window.location.href;});");
});
</script>
That works as far as I can tell.
I want to change the button from like to recommend and know from the Facebook site that I need to append an attribute of action=recommend to the URL. But as a newbie I've been unable to add it so it works. How can I add attributes to the URL?