I have recently started learning javascript and I am trying to do an exercise in which I have to hide a span element with a class inside a paragraph.
But I'm having trouble understanding how I can change the properties and if I'm using the correct method to get the element by its class.
Im getting the next error in console: Uncaught TypeError: Cannot set properties of undefined (setting 'visibility') at muestra (Ej3.js:5:24) at HTMLAnchorElement.onclick (VM28 Ej3.html:17:67)
This my code:
function muestra(){
var x = document.getElementsByClassName("adicional oculto");
console.log(x);
x.style.visibility = "hidden";
}