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

92
Views
Html set text color to colorwheel

I'm wondering how I can set the color of this text:

<p style="font-size: 30px; color: #222;" class="txt>Text example</p>

to the value selected on this color wheel:

<input type="color" value="#f6f82" id="colorPicker">

If the value of the color wheel changes, the text should adjust so the color is set to the value of the color wheel, how can this be done?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It's just a matter of updating the style of text onchange of input.

add onchange attribute to the input field which can call a JavaScript method.

Define the JS method to get the value from input and set the text style.

const setTextColor = (value) => {
    document.querySelector('.txt').style.color = value;
};
<input type="color" value="#f6f82" id="colorPicker" onchange=setTextColor(value)>
<p style="font-size: 30px; color: #222;" class="txt">Text example</p>

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!