Skip to content
Advertisement

Append a link when text overflowing parent

I’m using Ajax to get comments. Comment text is treated as max-height:90px by default. When importing comments, I want to attach a link if the text length is longer than the parent element. The code below doesn’t work well. It works imperfectly. All comments have a link or only the first one. Is there any right way?
enter image description here

JavaScript

Advertisement

Answer

Based on this SO answer. You can check if the text is bigger than your container and append more link to your HTML.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement