Truncate v.2.3 plugin for jQuery released — now preserves HTML formatting
I am happy to announce the release of Truncate v.2.3, a plugin for jQuery. I let this plugin simmer for awhile, and I thank each of you that sent me emails regarding a bug that went unfixed for some time. That bug is no longer an issue with this release, and I have added an important enhancement. The plugin will now truncate an HTML string, and preserve the formatting.
You can download the plugin and find examples at http://www.reindel.com/truncate.
Leave a Comment
Comments are moderated. No profanity. Only <a>...</a>, <blockquote>...</blockquote>, and <code>...</code> are allowed.
Seperate paragraphs by pressing the "Enter" key twice, or press it once to break to a new line.
3 Comments
#01, Feb 13 2008
Jon
I like Truncate very much. Thank you.
One problem: when a text block begins with a “p” tag, the “more” and “less” links appear on a new line instead of the same line as the text. Can that be fixed?
#02, Feb 13 2008
Jon
Addendum to my prior comment: The “p” tag problem appears in Firefox, Safari for Windows, and IE6. In Opera it works properly. IE7 was not tested. Also, in Firefox and Safari a “0″ appears at the top of each example div.
Thanks again.
#03, Feb 14 2008
Brian
Hi Jon,
I’m happy you like the plugin!
I will take a look at the issue with the paragraph tag. I noticed that jQuery was having some issues with that. Also, I need to do some research on how to treat a string that you want to truncate that is within an inline element. Currently, with my implementation, the “less” and “more” text will always be on a new line because it follows one of two divs that I insert. That is no good if there are divs within spans.
So, keep an eye out — I hope to deal with that soon :)