$('.twit').each(function(i,el){// grab the url and the link textvartwitterUser='@CMTCSolutions',url='https://twitter.com/home?status='+twitterUser+' ',text=$(this).text(),shareText=text.replace(' ','%20');// empty a tagvarnewNode=$('<a class="twit"></a>').attr('href',url+shareText).attr('target','_blank').html(text);// replace the current node with our new node$(el).replaceWith(newNode);});$('body').on('click','a.twit',function(e){e.preventDefault();newwindow=window.open($(this).attr('href'),'','height=300,width=350');if(window.focus){newwindow.focus()}});
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.