create array variable

夙愿已清 提交于 2019-12-01 14:09:57
var s1 = [];
$(".tblRows").each(function(){
    // create a temp array for this row
    var row = [];
    // add the phone and rating as array elements
    row.push($(this).find('.clsPhone').text());
    row.push($(this).find('.clsRating').text());
    // add the temp array to the main array
    s1.push(row);
});

You can do something like this:

var row = [];
$(".tblRows").each(function () {
    row.push([$(this).find('.clsPhone').text(),
              $(this).find('.clsRating').text()]);
});

$.jqplot('chart', [row], {
    //... 
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!