JSFiddle - React, Tailwind, and code Playground

by Clayton Bradley-Phillips

JavaScript

var content = "This is your content and we are looking truncate to thirty chars";

if (content.length >= 30) {
    var shortText = jQuery.trim(content).substring(0, 30).split(" ").slice(0, -1).join(" ") + "...";
    alert(shortText);
}