My html:
<span data-sample="http://mysite.com"></span>
My JS:
var objLink = $(this).attr('data-sample');
Hence my objLink == "http://mysite.com"
How can I add "www" and make the objLink == "http://www.mysite.com"?
Not sure this is the answer you are looking for, but you can use .replace() to do this.
objLink = objLink.replace("http://", "http://www.");
Check the demo: http://jsfiddle.net/XZKaj/
$(this).attr('data-sample', objLink);.replace("://", "://www.") if you want to allow for potential https links. Maybe add a condition to only do the replace if the url doesn't already have "www" in it...