Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!