Find any type of url, and replace "click here" text with regexp jquery

Posted by Takács Zsolt on Stack Overflow See other posts from Stack Overflow or by Takács Zsolt
Published on 2011-03-04T22:45:36Z Indexed on 2011/03/04 23:25 UTC
Read the original article Hit count: 258

Filed under:
|

Hi!

I need a little script in jQ because I have to change the long urls to a shorten "click here" text. I want to change only the url text not the value of href's attrib like this:

<a href="http://verylongurl.ext/ohshitwhatlongisit/yaythatstoolongforme">http://verylongurl.ext/ohshitwhatlongisit/yaythatstoolongforme</a> 

to..

<a href="http://verylongurl.ext/ohshitwhatlongisit/yaythatstoolongforme">click here</a>

The script must work on any possible type of url for example: http: https: ftp: and so on...

tyvm girls and guys!

Regs!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about url