<span class="url">google.com</span>
<span class="url">http://lwn.net</span>
What I would like is to reneder anything that is of class 'url' as a link. And I would also like to stick a http:// infront of links that are currently missing them.
For this I use JQuery (I should get around to doing something sensible in the database as well but not just now).
So the JQuery looks like:
$(".url:not(:contains('http://'))").prepend("http://");
$(".url").each(function() {
$(this) .replaceWith("" + $(this).text() + "");
});
$(".url").each(function() {
$(this) .replaceWith("" + $(this).text() + "");
});
That's it.
No comments:
Post a Comment