<script>
var interval = setInterval(Tinterval, 5000);
$('body').on('click', function() {
clearInterval(interval); // clear current interval
Tinterval(); // call instantly
interval = setInterval(Tinterval, 5000); // create new interval
});
function Tinterval(){
console.log('done');
main();
}
var main = function() {
var content = '';
for (var i = 1; i <= 100; i++) {
content += '<p>' + i + '</p>';
}
$(".results").append(content);
};
</script>
<div class="results"></div>
var interval = setInterval(Tinterval, 5000);
$('body').on('click', function() {
clearInterval(interval); // clear current interval
Tinterval(); // call instantly
interval = setInterval(Tinterval, 5000); // create new interval
});
function Tinterval(){
console.log('done');
main();
}
var main = function() {
var content = '';
for (var i = 1; i <= 100; i++) {
content += '<p>' + i + '</p>';
}
$(".results").append(content);
};
</script>
<div class="results"></div>
No comments:
Post a Comment