Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it possible to count the number of lines in the div element?

 
yuvaraj KumarAmudhan
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a div element and its innerHTML is some number of lines, loaded at runtime from the file.
i need to count the number of lines of that div element. i didn't get any idea about that!
idea please!

thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not easy, since I doubt you are asking about counting breaks.

If the text is all the same size, you can probably look at line-height and text-size. With that you might be able to guess.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a really odd thing to do. Why do you need to do this?
 
yuvaraj KumarAmudhan
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have to modify the particular line dynamically. thats why i need to count the lines in a div element.

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps if you supply a little more detail, we can help. Identifying a passage by "line" is really difficult and probably non-deterministic.

Perhaps the passage that needs to be modified can be identified as a <span> or other element that'll make this a whole lot easier and less error-prone.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic