Here’s a little something I threw together today that is simple, yet a bit useful too. I’ve been working on an application that consumes text from a JSON service on the client side and populates the page with the results, in real time. Some of the snippets of text have links in them, so I wanted something quick and easy to “linkify” any urls that are contained within the text. The result is this:

var linkifiedHtml = $.link("Go to http://www.google.com to search");

Which simply puts an anchor around the contained url. You can also use CSS selectors too… say you want to linkify every paragraph with the class foo:

$('p.foo').link();

That pretty much sums it up. Go grab it off github and feel free to fork it/add to it.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • BlogMemes
  • Blogosphere News
  • description
  • Fark
  • LinkedIn
  • NewsVine
  • StumbleUpon
  • Technorati
  • TwitThis
  • Yahoo! Buzz

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!