0

I have a div with text inside it Eg

    <div id="d1" style="width:50px;height:20px;background-color:tomato;">
            HelloHelloHelloHelloHelloHelloHelloHello
   </div>

How can i get the number of visible characters upto certain width(width of div) using jquery?

Muhammad Usman
  • 10,039
  • 22
  • 39
Sanket
  • 1
  • 1
    All the characters are visible in your example? – Liam May 03 '18 at 15:12
  • 1
    Sanket - As @Liam noted, you didn't include any `overflow` option. What are you using in your real situation? `overflow: none`? `overflow: auto`? `overflow: scroll`? Separately, is the text ever multiple lines? If so, what's the vertical overflow situation? Will there soemtimes be a scrollbar to worry about? – T.J. Crowder May 03 '18 at 15:14
  • Pete's almost certainly right about the duplicate, but if not, edit and let us know. – T.J. Crowder May 03 '18 at 15:16

0 Answers0