I am trying to use jquery ui progressbar. Below is code i have
<!DOCTYPE html>
<html>
<head>
<link href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script>
$(document).ready(function(){
$('#progressBar').progressbar({
value: 1
});
});
var statusTracker ;
var percentage = 0;
function checkStatus() {//function to fill progress bar
percentage = percentage +5;
$("#progressBar > .ui-progressbar-value").animate({
width : percentage + "%"
});
statusTracker = setTimeout(function() {//call this function every 20ms
checkStatus()
}, 20);
}
function startProgress(){
checkStatus();
}
function stop(){//stop progress bar
clearTimeout(statusTracker);
}
</script>
</head>
<body>
<div id="progressBar" style="opcity:1; height:30px;width:500px;" ></div>
<p>
<input type="submit" value="Start" onclick="startProgress()"/>
<input type="submit" value="Stop" onclick="stop()"/>
</p>
</body>
</html>
When i am clicking on stop button progress bar do not stop. My clearTimeout() function is not working. Any help will be appreciable .