Why does an internet explorer display my page in javascript back?

Here the version of the code that I use is split into parts that do not work. All of this is written to generate some basic pagination using jQuery.

In Chrome / Safari / Moz browser, I generate scroll information, 1,2,3,4, ... etc.

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

The string seems to be concatenation back.

It seems to me that this is very strange, because there is not much in the code here, I can’t understand which bit can cause problems.

Obviously, 1,2,3,4, ... etc. - this is what I was striving for here, so as an explanation of why this is a problem, I would like 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);
+3
2

for... in Array. , , .

JavaScript , , Array, .

for (var i= 0; i<array.length; i++). , jQuery, $.each.

+5

, - CSS "my_class" , -, javascript.

(str) ?

+2

Source: https://habr.com/ru/post/1740457/


All Articles