We can remove elements that were fetched using querySelectorAll
by iterating through the NodeList and calling the remove()
method on each element. Here is an example:
// Fetch the elements to remove const elements = document.querySelectorAll('.class-name'); // Iterate through the elements and remove them elements.forEach(element => { element.remove(); });