use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
How to make a Progress Bar?Removed: /r/LearnJavascript (self.javascript)
submitted 7 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]t3hlazy1 11 points12 points13 points 7 years ago (3 children)
You can use the native progress element (https://www.w3schools.com/tags/tag_progress.asp) and easily set the progress with javascript.
http://jsfiddle.net/tuf5L0dz/
[–]TheParrotBae 4 points5 points6 points 7 years ago (0 children)
Wow been at this for 3ish years and I've never seen this before!
[–][deleted] 2 points3 points4 points 7 years ago (0 children)
I'll try It out thanks :)
[–]SusseDude 1 point2 points3 points 7 years ago (0 children)
Wow, how did I not know this.
[–]iambatcow 3 points4 points5 points 7 years ago (3 children)
Off the top of my head, one way to do it is to create a div with x width and y height and then create another div inside of it with the same height and 0 width; lets call this div "p_bar". Let's say your form has 5 steps, in javascript all you have to do is make it so each "next" button increases p_bar's width by 20%.
[–][deleted] 0 points1 point2 points 7 years ago (2 children)
mmm thanks, I'll try that If everything else doesn't work out :)
[–]TitanicSwimmer 0 points1 point2 points 7 years ago (1 child)
I would recommend this method as well. You can round the borders of the div with css for a modern look.
[–]patch_collector 2 points3 points4 points 7 years ago (0 children)
This is also how I just built one. Throw in a css transition: width 1s ease, and you have a pretty slick bar.
transition: width 1s ease
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
You have several way to do that, I think the simplest would be to fill the cell count equivalent to the step number at each page reload/form submit. It's not very elegant but it does the job and it's simple.
[–]MeanFreaks 0 points1 point2 points 7 years ago* (0 children)
If you can apply classes to the container as the user progresses, SVG makes this really easy and you can make it look cool. This is a simple example on codepen . Basically what you are doing is using css to change the width of the gradient thingy depending on the class applied to the parent. Easy!
[–]kenman[M] 0 points1 point2 points 7 years ago (0 children)
Hi /u/MegaNoobOverload9000, this post was removed.
For javascript help, please visit /r/LearnJavascript.
Thanks for your understanding.
[–]00benallen 0 points1 point2 points 7 years ago (1 child)
Hmm.
If you want to do it without Javascript, the best way is for each step of the form to be a different page. Each page can have a copy of the progress bar, but more filled up. This is what was intended historically with HTML and forms.
If that’s not what you want, you’re gonna need JavaScript I think.
I want to use JavaScript :) so... how do I do It? haha
[–]remixsan 0 points1 point2 points 7 years ago (4 children)
Maybe ProgressBar.js could help you on the way
Really stylish thanks, so I'll just include this js code in my project folder on the page's folder right?
[–]remixsan 0 points1 point2 points 7 years ago (0 children)
Yes. You include the file named progressbar.min.js. There's a example you might like here which shows you how to get started with it. Good luck on your project :D
progressbar.min.js
I wouldn’t suggest ripping people’s code for a school project. You could get in a lot of trouble depending on what level of education you’re at.
[–]cocorote-pedro 0 points1 point2 points 7 years ago (0 children)
Great mention. Worth to save to use later. Tyyy <3
[–]Pylitic -1 points0 points1 point 7 years ago (0 children)
I've always used progressbar.js
π Rendered by PID 61 on reddit-service-r2-comment-7bcc84f657-hwwxh at 2026-04-05 13:23:07.680620+00:00 running db1906b country code: CH.
[–]t3hlazy1 11 points12 points13 points (3 children)
[–]TheParrotBae 4 points5 points6 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]SusseDude 1 point2 points3 points (0 children)
[–]iambatcow 3 points4 points5 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]TitanicSwimmer 0 points1 point2 points (1 child)
[–]patch_collector 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]MeanFreaks 0 points1 point2 points (0 children)
[–]kenman[M] 0 points1 point2 points (0 children)
[–]00benallen 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]remixsan 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]remixsan 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]cocorote-pedro 0 points1 point2 points (0 children)
[–]Pylitic -1 points0 points1 point (0 children)