在页面加载时将#hash 标签更改为链接

Bas*_*dge 1 javascript tags jquery hyperlink

如何使用javascript更改#标签+字符链接

This is going #right on the way
Run Code Online (Sandbox Code Playgroud)

和

This is going <a href="http://twitter.com/#!/search/right">right</a> on the way
Run Code Online (Sandbox Code Playgroud)

即使这也是可以接受的

This is going <a href="http://twitter.com/#!/search/right">#right</a> on the way
Run Code Online (Sandbox Code Playgroud)

该页面在不同的类和 id 中有很多 # (hash) 标签

amo*_*era 5

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

演示: http : //jsfiddle.net/dKm82/