【问题标题】:after shuffle a list get array with jquery洗牌后用jquery获取数组
【发布时间】:2010-04-27 03:47:07
【问题描述】:

我想在洗牌图像列表后将所有alt="" 值放在一个数组中! 但我总是得到保存值!为什么?

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

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


$.operation(a, shuffle);

【问题讨论】:

    标签: jquery arrays shuffle


    【解决方案1】:
    $('ul').shuffle(); //this will shuffle the list
    
    var a = new Array();
    $("ul > img").each(function(i) {
      a[i] = $(this).attr("alt");
    });
    
    
    $.operation(a, shuffle);
    

    【讨论】:

    • 顺便说一句,var a = [];var a = new Array(); 做同样的事情
    猜你喜欢
    • 2015-04-15
    • 1970-01-01
    • 2013-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 2023-03-07
    相关资源
    最近更新 更多