void Tricks Logo
void Tricks Logo

Tweet This - Highlight any text to tweet

A pure javascript plugin that gives you an option to tweet the text in your pages when you highlight it with the mouse.

Tweet This - Highlight any text to tweet

Plugin Features

Tweet This plugin is written with vanilla js. It is light weight and easy to integrate in your pages.

It is very useful if you have a blog with lots of quotes which people would want to tweet.


This is a sample text. Highlight this text with your mouse to tweet this text directly from this page.



Download the plugin and include the tweetThis.min.js file before closing of body tag or inside the head

Then initialize the plugin like this:

 <script> new tweetThis(); </script> 

To limit the plugin to a particular section of your page, pass id in the initialization of the plugin.

 <script> new tweetThis({ selector: "id_of_your_parent_element" }); </script> 


You can pass these options to override the default values

  • selector - takes the id of an element (without '#' symbol). body tag will be selected as default if no values passed.

  • appendText - this text will be appended to the selected text which will be filled in the tweet box.

  • tagClass - this allows you to set a custom class for the tweet button.

Comments (0)