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 8008045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:01:04+00:00 2026-06-04T18:01:04+00:00

I have a site with x instances of a class (they are loaded dynamically

  • 0

I have a site with x instances of a class (they are loaded dynamically through php). In each instance of the class there is a different amount of characters and i want all instances of the class with less than 110 characters to be narrower than the rest.

I have made it this far, which work with one instance of the class , but when two classes are loaded it calculates the total length of all instances of the class. I have looked into .each() for Jquery, but i cant seem to get the syntax right.

JQuery

if ($(".quotecontent").text().length < 110) {
        $(".quote").css("width", 500);
        //alert($(".quotecontent").text().length);
    }

HTML

<div class="quote">
<div class="quotestart"></div>
<div class="quotecontent"><p>We have a new toy!</p>
<div class="author">- Fernando Alonso</div></div>
<div class="quoteend"></div>
</div>

<div class="quote">
<div class="quotestart"></div>
<div class="quotecontent"><p>Fight to fly, fly to fight, fight to win.</p>
<div class="author">- Motto of the U.S. Navy Fighter Weapons School, TOPGUN</div></div>
<div class="quoteend"></div>
</div>
  • 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-04T18:01:07+00:00Added an answer on June 4, 2026 at 6:01 pm

    Demo http://jsfiddle.net/B3Uwj/11/

    Please let me know if I missed anything.

    Hope this helps.

    code

    $(".quotecontent").each(function() {
    
        if ($(this).text().length < 110) {
            $(this).parent(".quote").css("width", 500);
            //alert($(".quotecontent").text().length);
        }
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site with multiple pages, and each page has a table that
I have a site where people post news, it is written in PHP. Up
I currently have a site where different users can login, and depending on their
Suppose I have different sort of products on my site, so I have classes
I have two models: Project and Album . They are related to each other
I have site which uses $(selector).load(path) function in more than 300 pages. Now my
I Have site change.is, where right side menu & search bar in header is
I have site I am working on and the images take forever to load,
For example I have site http://localhost/site In IIS I set that 404 error causes
So I have site list on certain pages that basically just have links to

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.