Solved

Reset html5 progress bar

Posted on 2014-03-03
6
889 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now