Increase Count & Write on Click
HTML
<button>Click</button>
<div id="output"></div>
CSS
#output {
font-size: 50px;
}
JavaScript
var count = 0;
$('button').click(function(){
if (count > 5)
doCount();
else {
reduceCount();
}
writeOutput();
});
function writeOutput() {
$('#output').html(count);
}
function doCount() {
count++;
}
function reduceCount() {
count--;
}