jQuery: split and hide html data
Posted
by Peterim
on Stack Overflow
See other posts from Stack Overflow
or by Peterim
Published on 2010-03-26T17:31:27Z
Indexed on
2010/03/26
17:33 UTC
Read the original article
Hit count: 365
Hi guys!
I need to split somehow some html data (a text with html tags) into two parts and hide the second one with a show/hide link.
The thing is all texts are being stored in the database with html tags. Some of those texts are short, but some are really long. We don't want't to show long ones, so one of the options is to show a teaser with a show/hide link. I can't just cut the string though (let's say first 300 characters), because it'll break html code of the page.
I'm looking for a solution/suggestions how to show a teaser of the text using jQuery without breaking the html code of the page.
Thank you.
© Stack Overflow or respective owner