如何使用jquery更改特定时间间隔的内容 [英] How to Change the Content on Specific Interval using Jquery
问题描述
我有一个HTML标题标签,其中包含一条消息。现在按照我的要求,我需要每10秒更换一次消息。我的意思是我必须在特定时间间隔内更改标题标签的内容,以便消息这是显示将得到改变..
这是我的HTML ..
< h1 id =dynamicMessage> Responsive Page< br>< span> Message1< / span>< / h1>
请帮助我在jquery帮助下获得它。
在此先感谢..
这里不需要jQuery,您可以简单地做通过使用 如果您想加载一些动态加载的随机数据,则逻辑必须根据需要。 I have a Heading tag of HTML which contains a message.Now as per my requirement i need to change the message on every 10 Seconds.I mean i have to change the content of the heading tag on specific interval so that the message that is displaying will get change.. Here is my HTML.. Please help me to get it by the help of jquery.. Thanks in advance.. There is no need for jQuery here, you can simply do that by using If you want to load some random data which are loaded dynamically, then the logic must be different according to the need. 这篇关于如何使用jquery更改特定时间间隔的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! setInterval()$ c
$ p $ setInterval(function(){
$(#dynamicMessage) .html('here is your message');
},10000);
<h1 id="dynamicMessage">Responsive Page<br/><span>Message1</span></h1>
setInterval()
like,setInterval(function(){
$("#dynamicMessage").html('here is your message');
}, 10000);