Currently working on a JavaScript API using jQuery for my website. In one part of the code, I am attaching an object that contains CSS to an element like this: $(element).css(theVariable);
The expected outcome should match this CSS code snippet:
h3 {
background-color: rgb(0, 80, 0);
background-color: rgba(0, 80, 0.75);
}
How can I define theVariable so that calling css(theVariable) produces the same result as the CSS above? I am unable to use something like
theVariable = {};
theVariable['backgroundColor'] = 'rgb(0, 80, 0)';
theVariable['backgroundColor'] = 'rgba(0, 80, 0, 0,3)';
As the RGBA value would always overwrite the RGB value.
Is there any workaround for this issue?