How to hide/show more text within a certain length (like youtube)

前端 未结 14 710
说谎
说谎 2020-11-28 21:24

I want to have a text to only be a certain amount of characters/length and after that length, I want to put a link to reveal the full length of the text.

The link w

14条回答
  •  無奈伤痛
    2020-11-28 22:08

    I know this question is a little old (and has had it's answer selected already) but for those wanting another option that're coming across this question through Google (like I did), I found this dynamic text shortener:

    Dynamically shortened Text with “Show More” link using jQuery

    I found it was better because you could set the character limit, rather than extra spans in the code, or setting a specific height to a container.
    Hope it helps someone else out!

提交回复
热议问题