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

162
Views
How to have the color input element output values in hex and not RGB

I have a color input like this

function setstyle(elm, val) {
  elm.style.color = val;
}
<input type="color" name="fontcolor" id="fontcolor" value="#ffffff" onchange="setstyle('usermsg',this.value);">

when you choose a color this will automatically change the style in a separate text area. However, despite the input is in hex, it will always output it as RGB which I don't need. How can I fix that so it adds the equivalent hex value?

fiddle: https://jsfiddle.net/1a23t6w0/

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!