I need to update given selector continually after the given time intervel. this is my code using javascript.
function current_time(){
var content = document.getElementById('time_div');
content.innerHTML = '<p> Time is : '+Date()+'</p>';
}
var v = setInterval( 'current_time()', 1000);
this is ok. but my question is using jquery can we do that ? I tried this way. it works only one time. how I trigger that event continually after the given time interval(without click event).
$(document).ready(function(){
$('#time_div').click(function(){
$(this).html('<p>'+Date()+'</p>');
});
});
This should do the trick…
To make your original code a little friendlier to read…