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

190
Visualizações
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
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