class="progress"> <div class="progress-bar" style="width: 60%;"> </div> </div> var _width = 60; var interval = setInterval(function () { _width += Math.floor(Math.random()*10+1); if(_width>=100){ _width = 100; clearInterval(interval); } $('#progressBar').css({"width":_width+"%"}); }, 1000);