I have used jTwitter (jQuery plugin for Twitter) to retrieve and display tweets on my webpage. Everything is working except the links that are in tweets aren't clickable. I have tried different ways but I couldn't find a solution.
Here's the source
newstick.js
$(document).ready(
function(){
$.jTwitter('user', 10, function(data){
$('#newsticker').empty();
$.each(data, function(i, post){
$('#newsticker').append(
' <li>'
// See output-demo.js file for details
+ post.text
+' </li>'
);
});
$("#newsticker").newsTicker();
parseSamples();
});
}
);
I'm also using news ticker plugin so that I can display tweets as a ticker
<ul id="newsticker">
</ul>
Tweets are displaying somewhat like this but the links aren't clickable
jQuery Beginner: Checking how many elements were selected by $('.selector') http://t.co/berI7bu
jYouTube - jQuery YouTube plugin. Gets any video’s image http://t.co/vTxSmD5
I found a solution that uses regex
function replaceURLWithHTMLLinks(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(exp,"<a href='$1' target='_blank'>$1</a>");
}
This simple funcion will turn non-clickable links to clickable. Found this in here