0

I have a span tag in a table header below which is a multiline text and I want to add an ellipsis (...) If the line exceeds more than with in the cell with jQuery or JavaScript. I cannot use any CSS or jQuery plugins.

<span class=​"co_dcrTable_Header" style=​"width:​ auto;​">​Market capitalization at filing​</span>​
Alyona Yavorska
  • 569
  • 2
  • 14
  • 20
user3496151
  • 181
  • 1
  • 13

1 Answers1

0
            if(el.css("overflow") == "hidden")
            {
                var text = el.html();
                var t = $(this.cloneNode(true))
                .hide()
                .css('position', 'absolute')
                .css('overflow', 'visible')
                .width(el.width())
                .height('auto');

                el.after(t);

                while (text.length > 0 && (t.height() > el.height()))
                {
                    text = text.substr(0, text.length - 1);
                    t.html(text + "...");
                }

                el.html(t.html());
                t.remove();
            }

I have the above code it is not going into the while block since the condition t.height() > el.height() is failing as both heights are showing equal values . I have the span tag with the text

user3496151
  • 181
  • 1
  • 13