Instead of writing:
$('div').css({'backgroundColor': 'red'});
I want to write something like:
$('div').css({get_property_name(): 'red'});
where get_property_name() will return "backgroundColor", "color", "border-top-color", or any other property.
What options do I have to make it work ?
The
.css()method can also be called as.css(propertyName, value).If you really need the dictionary representation: