I am using JavaScript with jQuery. I have the following script to alert hi every 30 seconds.
$(document).ready( function() {
alert("hi");
setInterval(function() {
alert("hi");
}, 30000);
});
I want to alert hi when the page loads (when document / page gets completely loaded) and on every 30 seconds interval afterwards (like hi(0s) - hi(30s) - hi(60s).. etc). But my solution works on two instances. One on DOM ready and the other in a loop. Is there any way to do the same in a single instance?
You can see my fiddle here.