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

463
Visualizações
In electron, why can I not access DOM elements from the renderer thread?

I have the most basic example of an Electron app, with an index.html that has

<span id="foo"></span>

and also includes renderer.js via

<script src="./renderer.js"></script>

The problem is, when I try to change my DOM element from renderer.js:

var element = document.getElementById("foo")
console.log({element});
element.innerText = "123";

I get this error, and "element" is null:

Uncaught TypeError: Cannot set properties of null (setting 'innerText')

From my understanding, I'm not even using Electron features, I'm just using features that I could use in Chrome as well, so I don't get why this simple example won't work.

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