- Overview
- Documents
Linkify is a jQuery plugin for finding URLs in plain-text and converting them to HTML links. It works with all valid URLs and email addresses.
buyutucu pompa Spanish Fly
Source: soapbox.github.io
Aug 05, 2014 in Reader & Parser 3780 views
Linkify is a jQuery plugin for finding URLs in plain-text and converting them to HTML links. It works with all valid URLs and email addresses.
Source: soapbox.github.io
1. INCLUDE JS FILES
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="js/jquery.linkify.min.js"></script>
2. HTML
<p id="paragraph1">Check out this link to http://google.com</p> <p id="paragraph2">You can also email [email protected] to view more.</p>
3. JAVASCRIPT
$(window).on('load', function () { $('p').linkify(); });
4. OPTIONS
Linkify is applied with the following default options. Below is a description of each.
$('selector').linkify({ tagName: 'a', target: '_blank', newLine: '\n', linkClass: null, linkAttributes: null });
Option | Type | Default | Description | Data Attribute (used on the same element asdata-linkify) |
---|---|---|---|---|
tagName | String | "a" | The tag that should be used to wrap each URL. This is useful for cases where a tags might be innapropriate, or might syntax problems (e.g., finding URLs inside an a tag). | data-linkify-tagname |
target | String | "_blank" | target attribute for each linkified tag. | data-linkify-target |
newLine | String | "\n" | The character to replace new lines with. Replace with "<br>"to space out multi-line user content. | data-linkify-newline |
linkClass | String | null | The class to be added to each linkified tag. An extra.linkified class ensures that each link will be clickable, regardless of the value of tagName. Linkify won't attempt finding links in .linkified elements. | data-linkify-linkclass |
linkAttributes | Object | null |
HTML attributes to add to each linkified tag. In the following example, the tabindex and rel attributes will be added to each link.
$('p').linkify({ linkAttributes: { tabindex: 0, rel: 'nofollow' } }); |
N/A |
Tagged with:
linkify
jquery plugin
finding urls
html links
convert plain-text to links
valid urls
valid email addresses
intelligent url recognition
linkifying
Related Articles