Using variables in .css() with Jquery
<p>I'm running into a rather odd problem that I just can't seem to solve. I'm trying to use a variable in the .css() but it doesn't work. However if I type in 'background-color' directly within the .css() call it does. What gives?</p>

<pre><code>var css = that.data('css');
var targets = that.data('targets');
var value = that.val();
console.log(css + ' ' + targets + ' ' + value);
console.log(css === 'background-color');
    // returns true

$(targets).css({
    css: value
});
// Doesn't work!

$(targets).css({
    'background-color': value
});
// Works ok!
</code></pre>
