jQuery Plugin For Transforming URL To Link - urlToLink

File Size: 9.26 KB
Views Total: 896
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For Transforming URL To Link - urlToLink

urlToLink is a tiny jQuery plugin that allow you to automatically transform URLs in your content into links with target attributes.

How to use it:

1. Load the latest version of jQuery library and jquery.urlToLink.js script in your html document

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
<script src="jquery.urlToLink.js"></script>

2. Call the plugin with options

<script type="text/javascript">
$(document).ready(function(){
$('p').urlToLink({
target : '_blank'
});
});
</script>

3. All the URLs in your <p> elements will be transformed into links with target="_blank" attributes.

Change log:

v1.3.0 (2014-02-13)

  • Update Regex to match plus sign in URL

v1.2.0 (2014-01-20)

  • Improve URL regex matching

This awesome jQuery plugin is developed by gabrielizaias. For more Advanced Usages, please check the demo page or visit the official website.