Possible Duplicate:
Get hex value rather than RGB value using jQuery
I've got a <span>
like this:
<span class="colour" style="background:#000000;"></span>
In most browsers, including IE 8, I can get the hex value of the background colour like this:
$('span.colour').attr('style').match(/#[0123456789ABCDEF]{3,6}/gi);
However, in IE 9, $('span.colour').attr('style')
returns the following string:
background: rgb(0, 0, 0);
Do I have to convert back to hex in JavaScript, or is there a way to get IE 9 to give me the hex value (i.e. the thing that's actually in the damn HTML) straight from the element?