nathaniel
asked on
How to get the count of characters in one line displayed on a browser's page
Hi, Im looking for a javascript function for getting the count of characters in one line displayed on a browser's page.
For example:
The Quick brown fox jumps over the candle stick
> count should be 47
If the browser window is resized and it displayed the sentence like this,
The Quick brown fox jumps over
the candle stick
> count should be 30 (does not count the second line, only the first line)
For example:
The Quick brown fox jumps over the candle stick
> count should be 47
If the browser window is resized and it displayed the sentence like this,
The Quick brown fox jumps over
the candle stick
> count should be 30 (does not count the second line, only the first line)
I don't know if that is possible. The source code is the same in both cases. I don't know if that aspect of the display rendering is accessible with JavaScript.
@Author - Are you using a TextArea for displaying multiple lines? or some other control ?
Please look at below - Are you looking for a similar functionality ?
https://echo.co/blog/getting-line-count-and-length-javascript
Please look at below - Are you looking for a similar functionality ?
https://echo.co/blog/getting-line-count-and-length-javascript
ASKER
Hi Pawan, yeah similar to that but i want the character count instead of length in pixel (on first line).
Whatever html tag maybe used, Div or Textarea, as long as the function is able to return character count on the first line.
Whatever html tag maybe used, Div or Textarea, as long as the function is able to return character count on the first line.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much!
You are welcome.