Jump to content

hexColor is not defined


haku

Recommended Posts

I've got this part of my function:

 

var target = $(this).children(".inner_wrapper").attr("id");
var defaultColor = $("#" + target + " .color_picker").css("background-color");
var hexColor = defaultColor.replace("#", "");
if(defaultColor.match(/rgb/))
{
defaultColor = jqueryColorpicker.rgb2hex(defaultColor);
}
setTimeout("jqueryColorpicker.refreshColor(hexColor, \"#\" + target + \" .color_picker\")", 100);

The whole thing worked until I added the definition of hexColor, and the timeout function. So other than those two lines, the code is correct (this is all part of a much larger jquery function).

 

I'm getting the error that 'hexColor isn't defined' in this line:

 

setTimeout("jqueryColorpicker.refreshColor(hexColor, \"#\" + target + \" .color_picker\")", 100);

 

I can't wrap my head around it. hexColor looks to be defined to me, as I defined it right above.

Any thoughts?

Link to comment
https://forums.phpfreaks.com/topic/185974-hexcolor-is-not-defined/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.