I have an array of each element's attribute. I want to get all elements from that array by looping through the array. This is what I tried:
var array = ["blue", "yellow", "red"]; // these are name attributes of elements
for(var i=0; i<array.length; i++) {
var elements = Array.from(document.querySelectorAll("div[name="+array[i]+"]"));
}
Problem is that I get three separated arrays, I want one with all elements in it.