DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Hide Portion Of Text
// Just here for my reference really
$(".discussion-item:not(.child) a p").each(function() {
var iLimit = 155;
var sExcerpt = $(this).html().substr(0, iLimit); // Get the visible part of the string
var sHiddenText = $(this).html().substr(iLimit, $(this).text().length); // Get the hidden part of the string
// Set the new text with
$(this).html(sExcerpt + "<span class=\"hidden\">" + sHiddenText + "</span>");
$(".hidden").hide();
});





