To count number of text lines inside DOM element, we will use the following approach.
- Obtain the total height of content inside the DOM element.
- Obtain the height of one line.
- By dividing the total height of the content by the height of one line, you get the total number of lines inside the element.
- Before Clicking on the button:
- After Clicking on the button:
- Set the limit of text length to N lines using CSS
- How to vertically align text inside a flexbox using CSS?
- How to put a responsive clear button inside HTML input text field ?
- How to put the text inside of a created icon?
- Replace a DOM element with another DOM element in place
- CSS to put icon inside an input element in a form
- How to perform click-and-hold operation inside an element using jQuery ?
- How to enable/disable all input controls inside a form element using jQuery ?
- Text Animation with changing the color of the text using HTML & CSS
- How to create long shadow of text without using text-shadow in HTML and CSS ?
- How to embed text and text boxes in New Google Sites ?
- Remove new lines from string in PHP
- GRE Geometry | Lines and Angles
- How to create sloping lines using CSS?
- How to Make Oblique Lines with CSS / Bootstrap 3 ?
- HTML | DOM Input Text Object
- HTML | DOM Option text Property
- HTML | DOM Input Text value Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.