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

105
Views
Need to use the user's input in function

I'm a beginner. The idea of the whole thing is when a user clicks on a button, it prompts the user to insert a color name. Once inserted, the background should become the color the user chose.

Here's what I could come up with:

function changeColor() {
    let newColor = prompt("What color do you want?", "");
    document.getElementsByClassName("container").style.backGroundColor = `${newColor}`;
}

It doesn't work this way, but I have a feeling I'm somewhere close. Would appreciate some advice :)

about 4 years ago · Juan Pablo Isaza
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!