I get some strings that contain YouTube links (different lengths and phrases in the string, url in each string) And text These stars will be written in paragraph-tags, but I want the URL to be clickable, so I need an anchor tag around the URL.
I managed to find a way to reach that paragraph in which there is a link:
if ($ ("# facebookFeed p: happens ('http') Length) {// do stuff}
I'm stuck here and not sure that it's done correctly.
You must use regex to match URLs within the string, and then wrap them in an anchor:
$ ('P: happens ("http: //"). Html) (function (index, html) {Var url = html.match (/ (((FTP | https): \ / \ /) [\ - \ w @:% _ \ + ~ #, & \ / \ / =.?]] | ( (Mailto:?) [. _ \ W] + @ ([\ W] [\ w] - + +.) + [A-zA-Z] {2,3}) / g) $ .eee ( Url, function (i, v) {html = Html.replace (v, '& lt; a href =' '+ v +' "gt; '+ v +'
In the example given above
Comments
Post a Comment