dimanche 26 avril 2020

Loop through elements with IDs in JS

I'm trying to loop through all elements by ID in JS, I'm making a website and it's going p bad.

document.querySelectorAll('[id=has-money]').forEach(element=> 
    element.style.display = 'none';
});
document.querySelectorAll('[id=no-money]').forEach(element=> 
    element.style.display = 'block';
});  

This is what I have tried, I got no results nor errors, yet it's not working.




Aucun commentaire:

Enregistrer un commentaire