Solved

Reset html5 progress bar

Posted on 2014-03-03
6
936 Views
Last Modified: 2014-03-11
How do I reset an HTML5 progress bar back with Javacript to its original look after it's been used?
0
Comment
Question by:StarDusterII
  • 4
  • 2
6 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39901638
How are you setting it?  Should be just a simple case of setting the value with javascript.
0
 

Author Comment

by:StarDusterII
ID: 39902273
Not really setting it with anything.  The only thing I have in css is progress { width: 100%; }

So, what value to set?
0
 
LVL 58

Expert Comment

by:Gary
ID: 39902309
Then it should just  be a case of - are you using jquery?

$("#progress-bar-id").val("0")
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

Author Comment

by:StarDusterII
ID: 39902865
Not using jquery.  Here's what I'm using.  Basically, the progress bar is colored as the file is uploaded and when it's finished, I can't get the color back to it's original color.

<progress id="uploadprogress" min="0" max="100" value="0"></progress>
progress = document.getElementById('uploadprogress')
...
var complete = (event.loaded / event.total * 100 | 0);
progress.value = progress.innerHTML = complete;
...
progress.value = progress.innerHTML = 0;

Open in new window

0
 

Accepted Solution

by:
StarDusterII earned 0 total points
ID: 39909849
Apparently, you can't reset the progress bar too soon.  I set a timer for a couple of seconds after the file had uploaded and then:

progress.value = progress.innerHTML = 0;

That worked.
0
 

Author Closing Comment

by:StarDusterII
ID: 39919992
It was the timer that made it work.  You can't reset too soon and no one mentioned that.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question