[英]Replace text using jquery
I need to replace a text within div that says "Please wait..." with "Ok.Its done." 我需要将div中的“请稍候...”替换为“确定。完成。” 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>
在jQuery中,它将是:
$("myDiv").html("new content");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.