Change #hash tag for link to page load

How to change # tag + character to link using javascript

This is going #right on the way 

from

 This is going <a href="http://twitter.com/#!/search/right">right</a> on the way 

even that is also acceptable

 This is going <a href="http://twitter.com/#!/search/right">#right</a> on the way 

Multipage tags # (hash) in different classes and id

+1
source share
2 answers
 var string = "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/

+4
source

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. } }) 
+1
source

All Articles