JQuery get element from a string problem

Posted by SLC on Stack Overflow See other posts from Stack Overflow or by SLC
Published on 2010-06-07T12:11:28Z Indexed on 2010/06/07 12:12 UTC
Read the original article Hit count: 150

Filed under:

Sorry for such a simple question but I can't seem to find the solution.

I am trying to fade in and out some divs.

Divs have an ID of "div1", "div2", "div3".

My code is:

var Divs = new Array("div1", "div2", "div3");

I want to fade out one div and then fade in the next on top of it.

I have a setinterval that runs every 5 seconds and checked it works.

Inside it is this code:

 $(Divs[1]).fadeOut(1000);
 $(Divs[2]).fadeIn(1000);

However nothing happens when the timer method is ran. Any ideas?

© Stack Overflow or respective owner

Related posts about jQuery