Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey Guys,

I have an Array with a lot of progress bars in it. I parse these progress bars into a html-table later on. Every progress bar shall get a different ID so every progress bar is unique. This doesn't work quite well:

JavaScript
$.each(status, function (index) {
                           status[index] = '<div id="progressBar'+ index +'"><div></div></div>';
                           progress(percent, "#progressBar" + index);
                        }
                    });


The progress-function:

JavaScript
function progress(percent, $element) {
                var progressBarWidth = percent * $element.width() / 100;
                $element.find('div').animate({ width: progressBarWidth }, 500).html(percent.replace('\r\n', '') + "%");
            }


(I know the loop does not make much sense here, but it's a bit different in my code which isn't important in this context)

Any suggestions how I can solve my problem?
Posted
Comments
SrikantSahu 31-Jul-14 16:09pm    
Hi,
Just trying to understand your problem here..
Do you need a solution to generate dynamic divs or a better way of keeping track of the divs ?

Cheers!

1 solution

you generate div with unique ids but you getting problem to track those divs.
use parent child div jquery to track.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900