因为类名获取到的是数组,先取第0个元素 $('.mag')[0].setAttribute('src',data.url) $('.des')[0].innerText = data[i].summary