Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8789217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:20:36+00:00 2026-06-13T22:20:36+00:00

my text content output from mysql, but we can just treat it as plain

  • 0

my text content output from mysql, but we can just treat it as plain text for now.
I’d like to limit my words to 120 words, then add toggle show more button. I know toggle is easy to achieve, but I don’t really know how to limit my words and insert show more toggle button automatically.

this is my code

<div id="paragrah">
    Donec vitae mollis leo. Quisque ut metus ac velit porttitor sollicitudin quis mattis purus. Quisque id risus id sem porta gravida eu nec neque. Praesent non odio nibh, vitae tincidunt sapien. Maecenas rutrum mollis mauris, eu condimentum nunc viverra nec. Donec fringilla imperdiet volutpat. Morbi in sem ante. Phasellus libero purus, viverra a aliquam ac, eleifend eu nisl. Etiam quis odio nec quam rhoncus iaculis ac quis velit. Sed ut lacus quis enim tempor ullamcorper. Donec odio ligula, porta et bibendum aliquam, blandit vitae lacus.
    <div class="myimage">picture</div>
    <div class="myimage">picture</div>
    <div class="myimage">picture</div>
</div>

Also I attached an image to explain what I am expecting to achieve.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:20:38+00:00Added an answer on June 13, 2026 at 10:20 pm

    Try this snippet:

    function excerpt(str, nwords) {
      var words = str.split(' ');
      words.splice(nwords, words.length - 1);
      return words.join(' ') + '&hellip;';
    }
    

    Then cache your original contents with data and create a button to toggle between data and excerpt based on the text, either “show” or “hide”.

    Demo: http://jsfiddle.net/elclanrs/QLYey/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can we have content text directly in <div>text content</div> or it should be like
I have a script which produces text output. That script grabs content from a
I got texts output from PHP/MYSQL, and I used following jQuery to limit the
I'm just wondering when using CDATA in XML if i get the text content
I have a script which collects an image, link and some text content from
My code builds an xml output from mysql dataset. Then I need to transform
I just try mPDF to make an output table pdf by database, but it
Say I have the following text ..(content)............. <A HREF=http://foo.com/content >blah blah blah </A> ...(continue
I need to get the Portuguese text content out of an Excel file and
I am interested in reading ONLY the TEXT content of a UIWebView. How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.