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

187
Views
Get grandchildren without ID of element with ID

I have a website with many DIV elements without ID. The code of this website is created automatically with JavaScript, I can't change it. To change the z-index of selected elements without ID, I have to address them with JavaScript, with CSS it doesn't work.

How can I address children and grandchildren without ID using JavaScript?

I tried different functions but they do not work yet:

function huhu() {
  var x = document.getElementById("parent-element-with-id");
  x.querySelectorAll("*").style.zIndex = "9999";
}

function huhu() {
  document.querySelectorAll("#39 *").style.zIndex = "9999";
}

function huhu() {
  document.querySelectorAll("#39 > div > div).style.zIndex = "9999";
}

The JavaScript event:

<div onmouseover="huhu()"></div>

The working function:

function huhu() {
  document.getElementById("parent-element-with-id").style.zIndex = "9999";
}

The grandchild DIV without ID I want to address:

<div id="parent-element-with-id">
    <div>
      <div>
      </div>
    </div>
</div>

Besides, I also intend to address all * children and grandchildren. How can I achieve this?

about 4 years ago · Juan Pablo Isaza
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!