Do you mean like:
function setPhrase(phrase) {
var url = 'http://twitter.com/home?status=' + encode(phrase);
$('#phrase').html('<a href="' + url + '">' + phrase + '</a>');
}
...?
Un-jQuerying it should be straightforward enough, if that's how you roll.
This is un-jQueried:
function setPhrase(phrase) {
var url = 'http://twitter.com/home?status=' + encodeURI(phrase);
document.getElementById('phrase').innerHTML = '<a href="' + url + '">' + phrase + '</a>';
}
If you didn't see my failbraining encode
for encodeURI
as an error you should use Firebug. It may also fail if you have more than one element with the id phrase
or if you have no elements with the id phrase
.