This page is outdated

You are reading documentation for Linkify v2. Browse the latest v3+ documentation.

Jump To

Linkify DOM Element Interface

linkify-element is an interface for replacing links within native DOM elements with anchor tags. Note that linkify-element is included with linkify-jquery, so you do not have to install it if you are using linkify-jquery.



npm install linkifyjs
var linkifyElement = require('linkifyjs/element');

or with ES6 modules

import linkifyElement from 'linkifyjs/element';


<script src="linkify.amd.js"></script>
<script src="linkify-element.amd.js"></script>
    require(['linkify-element'], function (linkifyElement) {
        // …

Browser globals

<script src="linkify.js"></script>
<script src="linkify-element.js"></script>


var options = {/* … */};
linkifyElement(document.getElementById('id'), options, document);

This recursively finds links in text nodes within element #id.


  • HTMLElement element DOM Element to linkify
  • Object [options] Options object
  • HTMLDocument [doc] Explicitly pass in the document object or document implementation if on a non-browser environment like Node.js

Returns HTMLElement element The same element provided as input