Angel Vasilev Angel Vasilev - 2 years ago 127
CSS Question

Does the .css() method in jQuery support changing rgba values?

I have a which has a rgba css value (transparent), which I want to change on a click of a button which is in a different . The problem is that I am changing the color to a hex value and I can't seem to get rgba to work.
Code will be posted only if needed. My question is if .css() supports rgba

Answer Source

Try like this

var value1=$('#themeBackground1').val();
var opacity=$('#themeOpct1').val();
var rgbData=hexToRgb(value1);
value1='rgba('+rgbData.r+','+rgbData.g+','+rgbData.b+','+opacity+') !important;';
selector.attr('style', 'background-color:'+value1);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download