jQuery get img source attributes from list and push into array

后端 未结 2 1609
青春惊慌失措
青春惊慌失措 2020-12-24 02:59

I have this thumbnail list and would like push the image paths (sources) into an array: tn_array

2条回答
  •  太阳男子
    2020-12-24 03:36

    You can loop through ever img element:

    var tn_array = Array();
    
    $('#thumbnails img').each(function() {
        tn_array.push($(this).attr('src'));
    });
    

提交回复
热议问题