document.getElementByClassName('_2hvTZ pexuQ zyHYP')
f19c49e0e618e18 f8ca3372aa0bd8 f5c32cc227cf38
document.getElementByClassName('_2hvTZ pexuQ zyHYP')
f19c49e0e618e18 f8ca3372aa0bd8 f5c32cc227cf38
// 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)
document.getElementsByClassName(...)
(notice the 's' on 'Elements') or document.querySelector('._2hvTZ pexuQ zyHYP');
Feb 21, 2019 at 20:02
document.querySelectorAll(...)
returns an iterable list.Sorry about that.
Feb 21, 2019 at 20:06