Replace URL with HTML Link with Javascript and Jquery Plugins
💻 coding

Replace URL with HTML Link with Javascript and Jquery Plugins

1 min read 61 words
1 min read
ShareWhatsAppPost on X
  • 1The article provides jQuery plugins and JavaScript tips for converting text URLs into HTML links.
  • 2A specific JavaScript function is shared to replace URLs with clickable links in text.
  • 3The techniques discussed are particularly useful for enhancing social media web projects.

AI-generated summary · May not capture all nuances

Key Insight
AskGif

"The article provides jQuery plugins and JavaScript tips for converting text URLs into HTML links."

Replace URL with HTML Link with Javascript and Jquery Plugins

This post contains useful jquery plugins and javascript tip how to replace text URL to HTML links. I had tried these plug-ins at labs.askgif. I hope it's very useful for your social media web projects. Thanks!

Javascript Text to Link

<script type="text/javascript">
function text_to_link(text) 
{
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(exp,"<a href='$1' target='_blank'>$1</a>"); 
}
var linkdata=text_to_link("askgif programming blog http://askgif.com/blog/");
document.write(linkdata);
</script>

Enjoyed this article?

Share it with someone who'd find it useful.

ShareWhatsAppPost on X

AskGif

Published on 14 August 2019 · 1 min read · 61 words

Part of AskGif Blog · coding

You might also like