Get array of text values using selector instead of iterating?

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

I have some HTML like:

7条回答
  •  情话喂你
    2020-12-14 01:13

    you can do it like this

    var texts = new Array();
    
    $('#foo > span > a').each(function() 
    { 
      texts.push( $( this ).text() ); 
    });
    

提交回复
热议问题