You got the string, replace whatever
var oldCss="rgba(1,1,1,0.3)",
newOpacity = '0.5',
newCss = oldCss.replace(/[^,]+(?=\))/, newOpacity);
console.log(oldCss, "replaced with", newCss);
You got the string, replace whatever
var oldCss="rgba(1,1,1,0.3)",
newOpacity = '0.5',
newCss = oldCss.replace(/[^,]+(?=\))/, newOpacity);
console.log(oldCss, "replaced with", newCss);