Skip to content

Instantly share code, notes, and snippets.

@rickary
Created October 7, 2013 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickary/6867818 to your computer and use it in GitHub Desktop.
Save rickary/6867818 to your computer and use it in GitHub Desktop.
A Pen by Rick Chadwick.
<h1>Twitter Web Intent: Tweet</h1>
<p>Quick form to help you create a 'tweet' button for your users.</p>
<h2>Form</h2>
<label for="message">Message:</label>
<input id="message" type="text" />
<label for="hashtag">#:</label>
<input id="hashtag" type="text" />
<label for="hashtag">@:</label>
<input id="related" type="text" />
<input id="go" type="submit" value="Get the Code" class="btn" />
<h3>Result</h3>
<textarea id="result" value="" type="text" class="result" disabled></textarea>
$('#go').click(function() {
var message = $('#message').val();
var hashtag = $('#hashtag').val();
var related = $('#related').val();
var url = "<a href='http://twitter.com/intent/tweet?text=" + message + "&hashtags=" + hashtag + "&related=" + related + "'>tweet</a>";
$('#result').val(url);
});
@import "compass";
h1,h2,h3 { font-weight: bold; margin-bottom: 10px;}
h1 { font-size: 24px;}
h2 { font-size: 20px;}
h3 { font-size: 18px;}
p { margin-bottom: 20px;}
label { clear: both; margin-top: 20px; display: block;}
.result {
display: block;
width: 300px;
}
.btn {
display: block;
padding: 2px 10px;
font-size: 16px;
margin-top: 20px;
margin-bottom: 40px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment