document.queryselector multiple elements code example
Example 1: document.queryselectorall extract all href element
[].forEach.call( document.querySelectorAll('img.PinImageImg'),
function fn(elem){
console.log(elem.src);
});
Example 2: javascript how to pass more than one selector in querySelectorall
Is it possible to make a search by querySelectorAll using multiple unrelated conditions?
Yes, because querySelectorAll accepts full CSS selectors, and CSS has the concept of selector groups, which lets you specify more than one unrelated selector. For instance:
var list = document.querySelectorAll("form, p, legend");
...will return a list containing any element that is a form or p or legend.
Example 3: queryselector multiple attributes
var ele = document.querySelector('class[attr=something][attr2=somtethingelse]');