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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:48:12+00:00 2026-05-22T23:48:12+00:00

I have cobbled together some code to build an animated percentage bar. Everything works

  • 0

I have cobbled together some code to build an animated percentage bar. Everything works sweet when only one bar is present on a page. I have the following code

<div id="progress_bar" class="ui-progress-bar ui-container"> 
<div class="ui-progress" style="width: 60%;"> 
<span class="ui-label" style="display:none;"><b class="value"><span class="client_overall_progress">60</span>%</b></span> 
</div> 
</div>


$(function() {
var overall_progress = $(".client_overall_progress", this) .text();

// Hide the label at start
$('#progress_bar .ui-progress .ui-label').hide();
// Set initial value
$('#progress_bar .ui-progress').css('width', '7%');

// Simulate some progress
$('#progress_bar .ui-progress').animateProgress(overall_progress);
});

I would like to be able to place multiple percent bars on my page but i am not sure how to separate all the different values and have each bar render to the correct percent.

Can anyone help me out?

  • 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-22T23:48:13+00:00Added an answer on May 22, 2026 at 11:48 pm

    You are addressing your progress bars with an id of #progress_bar. Because elements IDs are suppose to be unique in the DOM, this will cause unexpected behaviors when trying to reach an element by it’s ID, like you do on your jQuery selectors.

    What you can do, is change #progress_bar into .progress_bar, and instead of defining it with the id of progress_bar, add it as another class to that top DIV.

    (edited into the answer from the comments on it for future references)

    You are calling .animateProgress on the whole set of .client_overall_progress. The solution is to iterate each .progress_bar .ui-progress and animate each element seperately. I’ve set up a jsfiddle to show you the problem and how to fix it: jsfiddle.net/4xgzq/1

    You should just look at the jQuery code and comment out the alert and uncomment the .animateProgress.

    BTW, I also placed an alert() before the .each(), to show you what happened with the first client_overall_progress selector you used in your script – it grabbed the text of the whole set of them. (That’s why the first alert() shows you 6060)

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

Sidebar

Related Questions

I have cobbled together a form due to some oddities in my code and
I have cobbled together a class that checks links. It works but it is
I have cobbled together some scripts from various internet sources to get a form
I was happy to cobble some code together that gives me a nice looking
OK, so I have a cursor adapter that I cobbled together from various source
I have cobbled the below together in my (very) humble jQuery hackish way: $(.toggle_container).hide();
This much I have already cobbled together (thanks to Stack Overflowers): I have a
First, the prior situation: We have this project with a one-click build script. It's
Have you guys had any experiences (positive or negative) by placing your source code/solution
So the problem.. I have been stuck with this one for a good month

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.