essentially I created new divs through JavaScript. append them to a div container. and then try to select them all in JavaScript with the same class like this const cards=document.querySelectorAll('.card'); but it says its null
how can I select them all after I created them in JavaScript?
Since you haven't shared a sample yet, I followed the logic based on the information you provided and I created a small example of 2 div's
appending them in another div. As you can see all the divs can be found in your container with console.log(document.getElementsByClassName('class')).
var div = document.createElement("div");
div.className = 'class'
var div2 = document.createElement("div");
div2.className = 'class';
var element = document.getElementById('id')
element.appendChild(div)
element.appendChild(div2)
console.log(document.getElementsByClassName('class'))
<div id="id"></div>