I'm trying to count all words which are actually displayed in a UI. I'm aware of code / solutions on how to count text and words using id's from the HTML, but in my case I do only want to count what is really displayed on the screen.
Consider the case of a long text in a p-tag which is placed inside a container. As the container is limited in width and length and the fontsize is fix, only the beginning from the text will be visible in the interface.
Any ideas on how could I count this "visible"/ displayed text, and not all of the text included in the p tag?
I have been thinking about using the height and width of the container, together with line height and fontsize to calculate how many lines are present in the container and therefore approximate the amount of words? But, if possible I would prefer an exact option.