I'm trying to insert or edit HTML elements with JavaScript, but I can't figure out how to get JavaScript to output HTML with HEX colors instead of RGB.
For example, if I wanted to change the color of an element to #ff0000
the JavaScript would actually output rgb(255, 0, 0)
, even when I use HEX colors in the script.
Please see this JSFiddle for an example.
What's the shortest route I can take to get the HTML code to have HEX colors instead of RGB?
Note: This is not a duplicate of this question. It's a very different problem. Converting the RGB value of one specific element to a HEX value for use in something else is completely different. I'm trying to generated HTML elements with HEX values instead of RGB. I need the innerHTML of a container to contain HEX values.