2010-04-27 7 views
0

내가 배열 한 모든 alt="" 값을 얻기 위해 이미지 목록을 뒤섞어 놓고 싶다! 하지만 항상 가치가 있습니다! 왜?shuffle after list jquery가 배열을 얻는다

$('ul').shuffle(); //this will shuffle the list 

var a = {}; 
$("ul img").each(function() { 
    a[this.alt] = $(this).attr("alt"); 
}); 


$.operation(a, shuffle); 

답변

0
$('ul').shuffle(); //this will shuffle the list 

var a = new Array(); 
$("ul > img").each(function(i) { 
    a[i] = $(this).attr("alt"); 
}); 


$.operation(a, shuffle); 
+1

단지 보조 노트'VAR의 A = [] '않는 VAR의 새로운 어레이 A =()'과 동일한 것; ' –