• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Showing short text in div/span

 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic