why is internet explorer displaying my javascript pagination backwards?

Posted by user278457 on Stack Overflow See other posts from Stack Overflow or by user278457
Published on 2010-04-09T13:30:01Z Indexed on 2010/04/09 13:33 UTC
Read the original article Hit count: 250

Here's a version of the code I'm using, stripped down to just the parts that aren't working. This is all written to generate some basic pagination with jQuery.

In Chrome/Safari/Moz, I generate see spans, 1,2,3,4,...,etc

When I look in IE7/8, I see etc,...,4,3,2,1

The string seems to be concatenating backwards!!

This seems very strange to me, because there's not a whole lot going on in the code here, I can't figure out which bit could be causing problems.

Obviously, the 1,2,3,4,...,etc is what I'm aiming for here, so as well as an explanation of why this is an issue, I'd love it if someone could offer a quick fix.

myVar = {
arr:$.makeArray($('.my_li'))
};

var str;
str='';

for (s in myVar.arr){
r=parseInt(s,10)+1;
str+='<span class="my_class">'+r+'</span>';
}

$('#my_other_div').html(str);

© Stack Overflow or respective owner

Related posts about quickfix

Related posts about jQuery