Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    id is a local variable, and will be destroyed as soon as the execution of frame has ended. You've to declare the said variable outside of frame. Also you'd probably need a setTimeout instead of setInterval. Commented Feb 17, 2015 at 11:56
  • 1
    If it works but not as expexted, perhaps your interval is too fast? setInterval takes in ms...so 1 = 1 ms regardless 10 ms is still really fast! Commented Feb 17, 2015 at 11:56
  • 1
    Could you please include an example of where you try with setInterval (or preferably setTimeout)? Commented Feb 17, 2015 at 12:07
  • 1
    It's pretty difficult to diagnose what you did wrong with your setInterval if you don't show us what you did. My gut feeling is that because you don't have an id on the <div> your code is no longer able to (easily) access it through the DOM Commented Feb 17, 2015 at 12:09
  • 1
    Thanks for the attention.. The answer of @Naeem Shaikh is what I needed Commented Feb 17, 2015 at 12:14