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.


Node.js module

Install from the command line with NPM

npm install linkifyjs linkify-element

Import into your JavaScript with require

const linkifyElement = require("linkify-element");

or with ES6 modules

import linkifyElement from "linkify-element";

Browser globals

Download linkify and extract the contents into your website’s assets directory. Include the following scripts in your HTML:

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


const 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