querySelector class? (JAVASCRIPT)

0

I made a function to change a photo when an element is added in my table, which table I created a class to get the photo to change, but to get the html element, I need to use the querySelector, but I'm not getting with class , but when it's with id it goes.

Ex:

function teste() {
  var elemento = document.querySelector('info-status');

    var conteudo = elemento.textContent || elemento.innerText;

    var teste = conteudo.length;

    if (teste > 0) {

      var img = document.getElementById('TrocaPost');
      var imgg = document.getElementById('TrocaEntregue');
      var image = document.getElementById('TrocaViagem');
      img.src = 'caminhao/caminhaoCERTOazul.png';
      imgg.src = 'caminhao/caminhaoCERTOazul.png';
      image.src = 'caminhao/caminhaoCERTOazul.png';

    }
}

o info-status when id, it takes, but when it is class it does not catch. Is there something wrong with my code or does the querySelector only handle ID?

    
asked by anonymous 23.11.2017 / 16:39

0 answers