Skip to content
Make sentences and snippets easily tweetable for your users.
JavaScript HTML
Branch: master
Clone or download
jmduke Merge pull request #4 from chrisvanpatten/patch-1
Support 280 character tweets
Latest commit 1e368d0 Feb 6, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Update Sep 26, 2013
test.html Update test.html Nov 3, 2013
tweetability.jquery.json Update tweetability.jquery.json Nov 22, 2013


A simple li'l plugin that lets you make site content easily tweetable.

Inspired (and by inspired I mean I stole this) from a recent New York Times article doing the exact same thing.

You can see a demo of the plugin in action here.



I mean, jquery is in the name and everything ...

The Basics

Using the plugin is super duper easy:


That will grab all elements with the data-tweetable attribute and create clickable links out of them. If the attribute in question has a value (e.g. data-tweetable='I love lamp'), the tweet's text will be set to that value; otherwise, it is set to whatever text is within the given element.

(If you're using a selector which is not an attribute, then be sure to set dataAttr so it knows where to pick up the text.)

The links are unstyled by default, but those links also are created with a given class (by default tweetable) so you can style them to your heart's content.


Options are pretty simple, and you can pass them as so:

	via: 'justinmduke'

The defaults:

// Defaults
	dataAttr: 'data-tweetable',
	linkClass: 'tweetable',
	via: null,
	related: null,
	url: window.location.pathname

The first two should be fairly obvious: via, related, and url all correspond to what you're passing to Twitter in terms of data.

You can’t perform that action at this time.