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!
The following searches for links whose text starts with
XXXX://where X is any number of non-whitespace characters and replaces the text with ‘Click here’:Here’s a demo.
Or, as Felix mentions below, a shorter way to write this would be: