I have some home made blog, and when viewing blog posts I’d like to change the title tag for adding the post title, so when I use the Twitter’s tweet button, it adds the new button. I tried:
<script type="text/javascript">
$(document).ready(function() {
$(this).attr("title", "<?php echo $tagValue["title"]." - YourCloud"; ?>");
});
</script>
And:
$(document).ready(function() {
document.title = "<?php echo $tagValue["title"]." - YourCloud"; ?>";
});
</script>
But the Tweet Button still has the title I set up at the start, how can I fix this?
EDIT:
In my index.php I add the title tag, I want to modify it so when you see the source it already appears modified
I think you want to set the text of the tweet, because by default the document title is tweeted. Well, you can modify the tweet button code to achieve this. See the href of the anchor element below where I added a ‘text’ parameter.
More here- https://dev.twitter.com/docs/tweet-button