Get an array of list element contents in jQuery

后端 未结 6 1357
日久生厌
日久生厌 2020-11-27 11:33

I have a structure like this:

  • text1
  • text2
  • text3

6条回答
  •  天涯浪人
    2020-11-27 11:59

    var arr = new Array();
    
    $('li').each(function() { 
      arr.push(this.innerHTML); 
    })
    

提交回复
热议问题