I am trying to modify the css of a class using jquery 3 and change the background color.
First I am converting a rgba color code (properties.color) to a hexadecimal code which works perfectly fine.
I then change the background of the „zu-default div“ class using jquery. This however does not work when I insert the variable „finalcolor“. When I hardcode a hexadecimal color such as „#fec23b“ , the change is visible. When I use the variable „finalcolor“ there is no change. Printing the variable finalcolor to the console shows that is a perfectly fine hexcode.
Any suggestions?
// converts a rgba to hex
let finalcolor = rgb2hex(properties.color);
//prints the converted hexadecimal (for eg: #fec23b)
console.log(finalcolor);
//Should modify the background of the zu-default div class to the color „finalcolor“
$('.zu-default div').css("background", finalcolor);
finalcolorvariable with e.g.#fec23bit works just fine so likely there is something wrong with your conversion.