document.getElementByClassName('_2hvTZ pexuQ zyHYP')
f19c49e0e618e18 f8ca3372aa0bd8 f5c32cc227cf38
答案 0 :(得分:0)
// We're going to get all the elements and force them into an array,
// rather than a nodeList. That's what the [... and ] are doing to
// our selector.
let myElements = [...document.getElementsByClassName('_2hvTZ pexuQ zyHYP')],
arrayOfIds = [];
// We can now use each member of myElements in a forEach. Within that,
// the current member is called 'element'. So we can see its ID, and do
// whatever we need to do with that.
myElements.forEach(function (element){ arrayOfIds.push(element.id);} );
console.log(arrayOfIds)