Truncate text

http://westmark.finalsite.com/

Look at the Facebook section. Given that HTML, is there anyway to truncate the text at a certain character amount? I know about substr and everything, but given the HTML with the dynamic-valued spans in the beginning/end…how should I approach this?

I’m using jQuery.

could you use a jQuery plugin like this one

http://mikeking.io/succinct/ ?

I’d rather not :frowning: . I’d prefer justa few lines of jQuery, instead of a plugin.

The actual plugin is like 50 lines, we could probably pull your few lines of jQuery out of there…

1 Like

This file has been truncated. show original

I see what you did there, Discourse.

Does that work though - would the plugin ignore the HTML tags and just grab the raw text (ignoring the HTML)?

Can’t really see if the demo is working to my needs or not.

Yeah, not sure if it would ignore tags inside the element or not…

I’m actually about to solve this same problem. Thanks for this.

Would straight CSS work? Do you have a specific width/height to abide by?

1 Like

nm, seems that won’t work with display: table. :frowning:

1 Like

No width/height; just basically I don’t want a 1000 word post messing crap up.

The problem with text-overflow is it doesn’t fit my situation unfortunately :frowning: .

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.