Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

103
Visualizações
Display None Conditional JavaScript Error

I have the following script that works when I use it in Google Console, but when I implement the custom script live, it will display: none; the class regardless of the conditions.

let notes = document.querySelectorAll(".elementor-element-befe370")[0];
let dents = document.querySelectorAll("elementor-element-1b86ce2");
dents.forEach; {
    if (document.body.textContent.includes("No, +1")) {
      notes.style.display = 'none';
    } else {
      notes.style.display = "block";
    }
};

If the dents text contains "No, +1" then I am looking to remove the notes element

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The syntax of your code is incorrect. The for each loop takes in a function. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach

let notes = document.querySelectorAll(".elementor-element-befe370")[0];
let dents = document.querySelectorAll("elementor-element-1b86ce2");
dents.forEach((dent) => {
    if (dent.textContent.includes("No, +1")) {
      notes.style.display = 'none';
    } else {
      notes.style.display = "block";
    }
})
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda