开发者

Replace text using jquery

开发者 https://www.devze.com 2023-01-09 10:13 出处:网络
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:

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");
0

精彩评论

暂无评论...
验证码 换一张
取 消