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

131
Visualizações
Element.Style.Propert In Js Broken For What Ever I Try

I am working on a website, but when I try to change the style property through js, it doesn't work.

I'm using the element.style.property to change the CSS, but whatever I try nothing works.

I Don't know how to fix this, although it might just be problem with my code editor or compiler

MY JS

  att1Btn.style.background = 'black;'
  att1Btn.style.color = 'white;'
  att2Btn.style.background = 'black;'
  att2Btn.style.color = 'white;'
  att3Btn.style.background = 'black;'
  att3Btn.style.color = 'white;'
  hBtn.style.background = 'black;'
  hBtn.style.color = 'white;'
  eBtn.style.background = 'black;'
  eBtn.style.color = 'white;'
  forfeit.style.background = 'black;'
  forfeit.style.color = 'white;'

MY HTML

    <div class="battle" id="battle" style="position: absolute; left: 0; width: 100%; height: 84%; background: #36afec;">
      <div class="menu">
        <div class="att1" id="att1" onclick="attNum = 1; curPmonFunc()"><br>ATTACK 1</div>
        <div class="att2" id="att2" onclick="attNum = 2; curPmonFunc()"><br>ATTACK 2</div>
        <div class="att3" id="att3" onclick="attNum = 3; curPmonFunc()"><br>ATTACK 3</div>
        <div class="forfeit" id="forfeit" onclick="lose()"><br>FORFEIT</div>
        <div class="health" id="health"></div>
        <div class="energy" id="energy"></div>
      </div>
      <div class="action">
        <div class="pokemon" id="displayP"></div>
        <div class="opponent" id="displayO"></div>
      </div>
    </div>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your error is ";" in color. It must be after color. Not in it.

let att1Btn = document.querySelector(".att1");
att1Btn.style.backgroundColor = 'black';
att1Btn.style.color = 'white';
about 4 years ago · Juan Pablo Isaza Relatório
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