Progress bar / animation to simulate "thinking" after form submission

We’d like to add a progress bar to simulate “thinking” after form submission, prior to triggering a thank you page. Anyone have a working example?

Are you just “faking it”? As in not actually loading anything? If so you can use a simple js progress bar like this

You can even do it in CSS

Thanks @digibomb … You’re correct, just for appearance. In this case, when a potential customer searches for specific contractor types in or near their zip, we currently match the contractor type and location instantly, but I’m looking for something to create anticipation. Something similar to the form here:

Ok, so this works. Just replace “I am here!” with your form code.


        let intervalId; // preserve intervalID so we can cancel it later
        let startTime; // preserve progressbar start time
        let continueFor = 5000; // X sec
        let interval = 10; // progressbar updte interval

        let wait =
            ms => new Promise(
                r => setTimeout(r, ms)

        let repeat =
            (ms, func) => new Promise(
                r => (
                    intervalId = setInterval(func, ms),

        window.onload = function() {
            let div = document.getElementById("div");
            let elem = document.getElementById("progress");
            let startTime = new Date().valueOf();

            div.hidden = true;

            // this function stop the repeats, when X sec is passed.
            let stop =
                () => new Promise(
                    r => r(setTimeout(() => {
                        elem.hidden = true;
                        div.hidden = false;
                    }, continueFor))

            // this function repeats to calculate progress bar value, at every interval.
            repeat(intervalId, function() {
                let elapse = new Date().valueOf() - startTime;
                elem.value = elem.max * elapse / continueFor;

    <div id="div"> I am here! </div>
    <progress id="progress" max="100" value="0"></progress>


Thank you sir! @digibomb

1 Like

Did it work for you?