Say I have a DOM model that has a collection of elements with class: class_1 and I use document.getElementsByClassName("class_1") to get an HTMLCollection of these elements.
If I take the first element of the collection is it possible to use the .getElementsByClassName("...") function again to get a secondary HTMLCollection of all the class_2 elements within the first element?
>Solution :
You can, with querySelector/querySelectorAll : Like so:
let allDivs = document.querySelectorAll('div');
let justThat = allDivs.querySelector('.subItemClass'); // null if not found