简体   繁体   中英

jquery read more link in a div's table cell only

so, this is the situation. I've got a table in a div, and this table contains a php recalling a content from MySQL. The fields are like "name", "surname" but also "comment" or "description", that can be quite long, So I'd like to cut them a certain point (like 150 letters) and than add a "read more". I've tried jquery shorten codes but those only work for the entire div, not for single cells.

Can you guys help me? Thanks a lot!

M

Try to put 2 things in your long cells (comment & description) :

  1. The shortened text you have by using the substr() method
  2. The full text

Only show the 1. and on click on your "Read more...", hide the 1. and show the 2.

I wanted to precise my anwser by some HTML / JS code but I'll give you all you give us to get your answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM