Truncate Text Lines In JQuery – Truncate.js

Truncate Text From The Middle Or End - jQuery Truncate
File Size: 2.63 KB
Views Total: 588 views
Last Update:February 23, 2024
Publish Date: March 13, 2011
Official Website: Go to website
License: MIT
Plugin Author: tbasse
Demo    Download

Truncate.js is a Free jQuery plugin that truncates text at the beginning, middle, or end of a content. With options for customizing truncation length, truncation characters, and ellipsis placement, Truncate.js is perfect for optimizing website design without compromising on functionality. Whether you need to truncate long titles, headlines, or descriptions, Truncate.js provides a simple solution to streamline your website’s text content.

How to use :

Add the jquery.truncate.min.js after loading the latest jQuery library.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/jquery.truncate.min.js"></script>

Initialize the plugin on the text wrapper.

<p class="demo">
  // options here

By default the plugin automatically truncate the text from the end to fit the width of its parent container. You can override the width option to truncate the text to a specific width.

  width: '200px',

Specify the position from which the text should be truncated. Default: ‘right’.

  side: 'middle', // or 'left'.

Specify what to replace the hidden text with. Default: ‘&hellip;’.

  token: 'More...',

Determine whether to apply the plugin to multiline text. Default: false.

  multiline: true,

Apply a CSS class to the text. Default: false.

  addclass: 'highlight',

Determine whether to add a title attribute to the text. Default: false.

  addtitle: true,

Cache the styles for multiple text with the same styles. Default: false.

  assumeSameStyle: true,


Thanks for make jQuery plugin is developed by tbasse For more Helpfull for users, please check the demo page or visit the official website.
List Of Version :


Mady Schaferhoff is an expert jQuery script at jQuerypost. He offers web development services to clients globally. He also loves sharing Html,CSS, jQuery knowledge through blog posts like this one.

Related jQuery Plugins