Get array of text values using selector instead of iterating?

后端 未结 7 2054
长情又很酷
长情又很酷 2020-12-14 00:18

I have some HTML like:

7条回答
  •  旧巷少年郎
    2020-12-14 01:13

    Try this:

    var texts = new Array();
    //or... var texts = [];
    
    $('#foo a').each(function() {
        texts.push($(this).text());
    })
    

提交回复
热议问题