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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:23:18+00:00 2026-05-23T09:23:18+00:00

I hope I phrased that correctly. I’m using a jQuery function to resize text

  • 0

I hope I phrased that correctly. I’m using a jQuery function to resize text within separate spans based on how long the text is. So far so good, but it’s totaling all the values and I need it to check them individually and base the resizing rules on the longest value. The snag is that the span(s) in question are rendered with a for-loop, so it’s no wonder it’s combining the values. There’s never more than three of these spans displayed at once.

Can anyone help?

<script type="text/javascript">
var $quote = $(".check_in_footer .last_check.units");
var $numWords = $quote.text().length;

jQuery(document).ready(function($) {

    alert($numWords);

    $(function() {
        if (($numWords >= 1) && ($numWords < 6)) {
            $quote.css("font-size", "400%");
        }
        else if (($numWords >= 7) && ($numWords < 8)) {
            $quote.css("font-size", "600%");
        }
        else {
            $quote.css("color", "#ff0000");
        }

    });
});

  • 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-05-23T09:23:18+00:00Added an answer on May 23, 2026 at 9:23 am
      $(".check_in_footer .last_check.units").each(function () {
      var $numWords = $(this).text().length;
    
        if (($numWords >= 1) && ($numWords < 6)) {
            $(this).css("font-size", "400%");
        }
        else if (($numWords >= 7) && ($numWords < 8)) {
            $(this).css("font-size", "600%");
        }
        else {
            $(this).css("color", "#ff0000");
        }
    
      });
    

    And you need to remove first two lines of your code (right under opening script tag.
    I didn’t check the rest of the code, just implemented the loop logic.

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

Sidebar

Related Questions

hope you can help me on this one, I'm currently using this: jQuery plugin:validation
Hope I'm asking this correctly: I have a project Projects.Client I have my class
Hope this makes sense, I am using Titanium mobile to build an iPhone app.
Hope the title is not that confusing - honestly said I had no idea
hope someone can help. I appreciate there are a few questions that are similar
I have a ModelForm field that is based on the following Model: class Phrase(models.Model):
I think (hope) my question is simpler than how I've phrased it, but this
Hope some one can help. Using the DDay.iCal version 1.0.1.490 with .net version 2
I hope the question is phrased well enough for someone to understand. I understand
Alright, I hope I can phrase this in a way that makes sense. If

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.