I have text inside div and i want it to be ellipse as per the div width in one line. If I am re sizing the window so it should calculate the width and fit the text into it with ellipse and "More" text. Right now, I am defining letter size and substr
it. which is not working in case of resizing.
var showChar = 50;
var ellipsestext = "...";
var moretext = "more";
var lesstext = "less";
$('.eve_ticket .ticket_type').each(function() {
var content = $(this).html();
if(content.length > showChar) {
var c = content.substr(0, showChar);
var h = content.substr(showChar-1, content.length - showChar);
var html = c + '<span class="moreellipses">' + ellipsestext+ ' </span><span class="morecontent"><span>' + h + '</span> <a class="morelink">' + moretext + '</a></span>';
$(this).html(html);
}
});