0

I have problem with jQuery, when I am getting color using jQuery css like this

$('#myElement').css('background-color')

it gives me RGB color and in my HTML, I use hex colors.

<div id="myElement" style="background-color: #ff0000;">some text here</div>

I need to convert RGB color to hex using JS or jQuery... for example rgb(255,0,0) to #ff0000

Can anyone help me?

Matt
  • 74,352
  • 26
  • 153
  • 180
Max Leps
  • 469
  • 3
  • 12

0 Answers0