Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Showing short text in div/span

 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a long text like this "Hello this is a long text and this is a very long text, it can be one line or blah blah."

Now i would like to show it "Hello thi"<a href="#">more..</a>.

Click the more will show the complete text as tip or div popup.
Now could someone please tell me how to shorten the text to certain length using CSS or Javascript?
Is it possible ?
Thank you.
Regards
Balaji
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you could certainly write a bunch of JavaScript to go through the page during onload and to shorten text content (perhaps identified via CSS class names), replacing it with the shorter text and link. But it strikes me that this would be much easier to accomplish on the server side with a JSP cutom tag or ilk.

Are you not using a server-side language?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic