javascript document queryselectorall code example
Example 1: selet all elemnts
var elems = document.body.getElementsByTagName("*");
Example 2: class query css js all
var matches = document.querySelectorAll("div.note, div.alert");
Example 3: js queryselectorall
var container = document.querySelector("#test");
var matches = container.querySelectorAll("div.highlighted > p");
Example 4: query selector has clas
document.body.classList.add('thisClass');
document.body.classList.remove('thatClass');
document.body.classList.toggle('anotherClass');
Example 5: js queryselector names
document.querySelector('[name="your-selector-name-here"]');
Example 6: javascript queryselector
const myParagraph = document.querySelector('.example');
myParagraph.textContent = 'This is my new text';