Skip to content

oleksandr-pol/jQuery-truncate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

jQuery truncate text

The plugin is used to truncate text. It also adds hellip to the end of string. Click on hellip (...) allows you to see the whole text.

Code Example

To truncate a text inside the element use next method:

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

The paragraph before using method:

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. In ad eveniet, harum non. Quaerat voluptatem 

totam explicabo repellat cumque rerum nesciunt, quia in, qui nostrum, recusandae eligendi sequi. Nihil, 

quas.</p>

The paragraph after using method:

<p>Lorem ...</p>

The length of hellip and white spases are also taken into account.

It is possible to see the whole text after clicking on hellip (...):

Example

Argument

The argument must be positive integer number and greater than zero. If the argument is bigger than text length, method is doing nothing.

One element is mandatory (used to show the hellip)

About

jQuery plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published