-3
Buyer Guarantor: 
ABC Company 
RE, Inc. 
(NewYork)

The above text is present in the span as a multiline text. Is there a way in jquery or javascript to check the number of lines present ? in the above case it should return 4.

Was trying to add ellipses to the the text if the text is 'overflow' in css. When i try to get the height of the span after cloning it , both the heights are same.

I just want to add ellipses to the text if the text is multiline.

Kunj
  • 1,980
  • 2
  • 22
  • 34

1 Answers1

0

try this:

function get_lines(selection){
     parseFloat($(selection).css("height"))/parseFloat($(selection).css("line-height"))
}

how to use:

 number_of_lines=get_lines("#your_span");
mondersky
  • 441
  • 2
  • 15