<script>
function x(){
let qq = document.querySelectorAll(".q");
console.log(qq);
}
</script>
<body>
<button id="btn" onclick="add()">Press </button>
<div class="q" id="a">aaaa</div>
<div class="q" id="b">bbbb</div>
</body>