This post was written 5 years ago and therefore may not be as accurate as more recent posts.

Here is some code that allows you to have a HTML Valid Twitter tweet button?

Move the code into a document.write JS function and it will all validate.

<script type="text/javascript">
/* <![CDATA[ */

document.write(‘<a href="" class="twitter-share-button" data-url="" data-text="Some message to post" data-count="horizontal" data-via="shanejones">Tweet</a>’);

/* ]]> */
<script src="" type="text/javascript"></script>

Categories: Twitter Dev

Tags: ,
Shane Jones

Posted by

Shane is the Co-Founder of Peadig, the WordPress framework and has gained over 40,000 downloads of his WordPress plugins. Shane also likes to tinker with API's and specialises in Facebook, Twitter, Instagram and Foursquare API. The views expressed in Shane's posts are his own and are not necessarily the views of his employers.