Skip to content Skip to sidebar Skip to footer

Change #hash Tag To Link On Page Load

How to change # tag + Character to link using javascript This is going #right on the way with This is going right on t

Solution 1:

varstring = "This is going #right on the way";
string.replace(/#(\S*)/g,'<a href="http://twitter.com/#!/search/$1">$1</a>')

Demo:http://jsfiddle.net/dKm82/

Solution 2:

here is my suggestion

(function(){

$.fn.hashlink = function(){
  this.text(this.text().replace(\#(w+)\),"<a href='twitter.com/#!/search/$1'>$1</a>")
  text = \#w+\g.
}    

})

Post a Comment for "Change #hash Tag To Link On Page Load"