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

126
Views
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 answers
Answer question

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 Report
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!