Capturing elements by tag and inserting inside an array

0

Well, I'm mounting a merry-go-round on a test project, and I had a question, how can I, with vanillaJS , capture certain elements by tag , and put them within array ? The idea would be more accurately, to capture according to the position in the body of HTML , for example, to capture all figure that are within a div whose parent is #banners.

How can I do this when loading the page?

    
asked by anonymous 20.03.2017 / 12:49

1 answer

1

You can use document.querySelectorAll , like this:

var arr = document.querySelectorAll("#banners figure")
    
20.03.2017 / 13:10