Javascript / jQuery or something to change text every some seconds

后端 未结 4 2137
执笔经年
执笔经年 2020-12-13 10:52

Need JavaScript or jQuery something to change text every some seconds... with user doing anything.

Example:

\"Welcome\" changes to \"Salmat datang\" change

4条回答
  •  别那么骄傲
    2020-12-13 11:27

    You can use setInterval to call a function repeatedly. In the function you can change the required text.

    The list of texts to change between could be stored in an array, and each time the function is called you can update a variable to contain the current index being used. The value can loop round to 0 when it reaches the end of the array.

    See this fiddle for an example.

提交回复
热议问题