How do I add items to an array in jQuery?

前端 未结 3 1015
慢半拍i
慢半拍i 2021-01-31 07:25
var list = [];
$.getJSON(\"json.js\", function(data) {
    $.each(data, function(i, item) {
        console.log(item.text);
        list.push(item.text);
    });
});
con         


        
3条回答
  •  旧时难觅i
    2021-01-31 07:50

    Hope this will help you..

    var list = [];
        $(document).ready(function () {
            $('#test').click(function () {
                var oRows = $('#MainContent_Table1 tr').length;
                $('#MainContent_Table1 tr').each(function (index) {
                    list.push(this.cells[0].innerHTML);
                });
            });
        });
    

提交回复
热议问题