Show and hide text in several elements of the same class

0

I have that code but it does not work for me can someone help me?

    
asked by Alst Adm 17.10.2018 в 02:31
source

1 answer

0

Welcome to the community.

"getElementByClassName" returns an array with all the elements of that calse, so to edit them, you must go through that array.

Try something like this

var x = document.getElementsByClassName('info-mas');

for (var i = 0; i < x.length; i++) {
  x[i].style.display= "none";
}

I also recommend that when you ask a question, publish your code as text and not as an image; so we can help you easier.

I hope you serve, you can see an example here link

    
answered by 17.10.2018 / 02:57
source