How do I change the display of a class using JavaScript?
A suggestion, why not use JQuery. It's quite simple and easy, style can be none/inline/block etc
$('.className').css('display','style');
Show:
document.querySelectorAll(".login").forEach(a=>a.style.display = "initial");
Hide:
document.querySelectorAll(".login").forEach(a=>a.style.display = "none");
Changing display
of every element is bad idea. Just toggle class of all these login
s wrapper and set display
in CSS.
A bit late now but this gets some views. Why not:
var arrayOfElements=document.getElementsByClassName('login');
var lengthOfArray=arrayOfElements.length;
for (var i=0; i<lengthOfArray;i++){
arrayOfElements[i].style.display='inline';
}