IE JavaScript Mystery

Posted by William Calleja on Stack Overflow See other posts from Stack Overflow or by William Calleja
Published on 2010-04-21T12:17:04Z Indexed on 2010/04/21 12:23 UTC
Read the original article Hit count: 254

Filed under:
|

I have the following JavaScript function

function headerBanner(){
    var current = $('.bannerImages img:nth-child('+bannerIndex+')').css('display', 'none');
    if(bannerIndex== $('.bannerImages img').size()){
        bannerIndex= 1;
    }else{
        bannerIndex= (bannerIndex*1)+1;
    }
    var next =  $('.bannerImages img:nth-child('+bannerIndex+')').css('display', 'block');
}

In every browser on the planet, with the exception of IE (8, 7 or less), the above code is working correctly. In Internet Explorer it's going through it and having no effect. I've put alerts at every line of the function and they all fire, even in IE, but the banner simply doesn't change. Is there any reason as to why this is so?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript