<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<p id="demo">0</p>
<button type="button" onclick="myFunction()">Try it</button>
</div>
var count = 0;
//
function myFunction() {
var a=document.getElementById("demo");
count = count+1;
a.innerHTML=count;
if(count ==5)
{
count=0;
}
}