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

84
Views
remove header div from a specific pages with dom

I need to remove a section of the header with DOM for an A/B test. I need to do it just in two pages, but the problem is that I have the same classes in all the pages with the header and I don't want to remove it from all pages.

The html structure is like this:

<nav class="navbar navbar-dark fiex-top">
<div class="header-logo">
<div class="progress-indicator">
</nav>
<section class="main-page-container">
<div class="container about-page">

I need to remove "progress-indicator"

I tried adding this code

 const new1 = document.querySelector(".main-page-container");
    if (new1.classList.contains('about-page')) {
      document.querySelector(".progress-indicator").remove();
    } 

And this one

   const removeheader = querySelector(".container.about-page");
if (removeheader.length > 1) {
document.querySelector(".progress-indicator").remove();
}

It was the idea I had, because inside I have a div with a different class in each page, but it didn't give me results, I don't know if it's possible to modify it like this

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

I solved it with this code:

 const removeheader1 = document.querySelector(".container.about-page");
        if (removeheader1.classList.contains('about-page')) {
          document.querySelector(".progress-indicator").remove();
        }

It seems that the problem was in the way I added the classes

about 4 years ago · Santiago Gelvez 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!