Text in div limited characters, add “Read more” link and show all characters when link is clicked
问题 I've a div with text inside that is displayed using PHP & MySQL, the structure is like this: <div class="description"> <p> Here is a lot of text. </p> </div> I want to display a "Read more" link when the text inside the p-tag is more than 100 characters. I can display the "Read more" link with PHP like this: // strip tags to avoid breaking any html $string = strip_tags($string); if (strlen($string) > 100) { // truncate string $stringCut = substr($string, 0, 100); // make sure it ends in a