jQuery Plugin To Trim Text String with Ellipsis - Trunc.js

jQuery Plugin To Trim Text String with Ellipsis - Trunc.js
File Size: 3.23 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Trunc.js is a dead simple (less than 1kb) jQuery text truncation plugin that truncates text to a specified number of characters with an ellipsis.

How to use it:

1. Load the JavaScript file Trunc.js after you've loaded the jQuery library as shown below:

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="trunc.js"></script>

2. Call the function on the target text container and pass the number of characters you want to keep as the first parameter to the trunc method.

$('p').trunc(140);

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