?
Solved

Reset html5 progress bar

Posted on 2014-03-03
6
Medium Priority
?
1,261 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

850 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