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

153
Visualizações
Having trouble adding class to a table on load that is generated dynamically by Javascript

I have a function that runs on load in the body tag. It sets the body elements correctly, but it won't add the 'table-dark' class to a table that is generated dynamically by javascript.

 if (darkThemeSelected){
            console.log("setting theme to dark");   
            var element = document.body;
            element.setAttribute('data-theme', 'dark');

          $('table').addClass('table-dark');}

I tested with a static table and that table get's the added class, but having trouble with the dynamic table.

I've tried moving the function later in the document, and calling it later, but this doesn't seem to care.

Stumped...

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