my text content output from mysql, but we can just treat it as plain text for now.
I’d like to limit my words to 120 words, then add toggle show more button. I know toggle is easy to achieve, but I don’t really know how to limit my words and insert show more toggle button automatically.
this is my code
<div id="paragrah">
Donec vitae mollis leo. Quisque ut metus ac velit porttitor sollicitudin quis mattis purus. Quisque id risus id sem porta gravida eu nec neque. Praesent non odio nibh, vitae tincidunt sapien. Maecenas rutrum mollis mauris, eu condimentum nunc viverra nec. Donec fringilla imperdiet volutpat. Morbi in sem ante. Phasellus libero purus, viverra a aliquam ac, eleifend eu nisl. Etiam quis odio nec quam rhoncus iaculis ac quis velit. Sed ut lacus quis enim tempor ullamcorper. Donec odio ligula, porta et bibendum aliquam, blandit vitae lacus.
<div class="myimage">picture</div>
<div class="myimage">picture</div>
<div class="myimage">picture</div>
</div>
Also I attached an image to explain what I am expecting to achieve.

Try this snippet:
Then cache your original contents with
dataand create a button to toggle betweendataandexcerptbased on the text, either “show” or “hide”.Demo: http://jsfiddle.net/elclanrs/QLYey/