I have one div I have give it some specific line-height
and width
.
I have put my code below
document.getElementById("content").onload = countLines();
function countLines() {
var el = document.getElementById('content');
var divHeight = el.offsetHeight
var lineHeight = parseInt(el.style.lineHeight);
var lines = divHeight / lineHeight;
console.log("Lines: " + lines);
}
<div id="content" style="width: 80px; line-height: 20px">
hello how are you? hello how are you? hello how are you? hello how are you?
</div>
but I want to show only 3 lines from that div
and remove all other lives from that div
and this 3 number comes dynamically and I want to remove all other lines with jquery.