0

次のような単純な配列を作成したいとitem_structure = {thumb, head, cont}思います。コードは次のとおりです。

$('.items_options').find('#'+item_id+' .option .blog_item_structure li')
                   .each(function(event) {
    var item_class = $(this).attr('class');
    item_structure[] = item_class;
});

しかし、表現が機能しitem_structure[] = ...ていないようです。では、リグ構文とは何か知っている人はいますか?

あなたの時間のためのThx。

4

1 に答える 1

0

あなたはおそらく価値を意味しpushます:

item_structure.push(item_class);

item_classこれは、の最後の要素として追加されitem_structureます。

これが機能item_structureするには、配列である必要があり、最も簡単に次のように作成できます。

item_structure = [];
于 2013-01-11T22:17:05.583 に答える