I have text inside a DIV tag. Is it possible to change the text content with five different text contents in cycle that never ends? Sounds simple, but I’m trying to find the easiest approach with jquery or related.
Many thanks,
Erik
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Really simple approach: use
setInterval().http://jsfiddle.net/mattball/TJv3K/
Edit If you want to get fancier with the effects: http://jsfiddle.net/mattball/TJv3K/1/
Edit 2 re OP comments (below)
<script>tags.Other fixes needed (shown in both fiddles):
Actually load jQuery from somewhere, otherwise none of this code will work.
Remove the trailing comma at the end of the first
textarray literaltextarray declarations to commas, otherwise the following variables (iand$div) will be declared as global, which is a bad thing.