removeAttribute JavaScript

0

I'm learning JavaScript and have done the following function:

var marcaAgua = document.getElementById('marca-agua');

var reso = window.matchMedia("(min-width: 768px)");

function pngReso(reso){
  if (reso.matches){
     marcaAgua.removeAttribute("hidden");
     window.onscroll = function() {navbarFunc()};
  } else {
     console.log('entoru mobile');
     window.onscroll = null;
  }
}

pngReso(reso);
reso.addListener(pngReso);

However, in the browser it gives the error:

  

Can not read property 'removeAttribute' from null to pngReso

And the function does not run, and I do not know what I'm doing wrong.

    
asked by anonymous 19.09.2018 / 13:41

0 answers