Get array of text values using selector instead of iterating?

后端 未结 7 2049
长情又很酷
长情又很酷 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());
    })
    
    0 讨论(0)
提交回复
热议问题