I need to replace a text within div that says "Please wait..." with "Ok.Its 开发者_Python百科done." after a random delay.Please help.Thanks in advance.
Try this:
$("#foo").text("Please Wait...")
.delay(Math.random() * 1000) // between 0 and 1000 milliseconds
.queue(function(q){
$(this).text("okay, it's done");
q();
});
<script type="text/javascript">
window.onload = function () {
setTimeout(function () {
var div = document.getElementById('yourDiv');
div.innerHTML = "OK. It's done.";
}, 10000);
}
</script>
in jQuery, it would be:
$("myDiv").html("new content");
精彩评论