JSFiddle - React, Tailwind, and code Playground

HTML

<div id="first"></div>
<div id="second"></div>

CSS

#first {
    position: relative;
    width: 200px;
    height: 200px;
    background-color: rgb(100,100,100);
}
#second {
    position: absolute;
    top: 150px;
    left: 150px;
    width: 100px;
    height: 100px;
    background-color: #f5f5f5b8;
}

JavaScript

$(document).ready(function() {  
   add_alpha_channel();   
});

function add_alpha_channel()
{
    var oldBGColor = $('#second').css('background-color');
    var newBGColor = oldBGColor.replace(/[^,]+(?=\))/, '0.8');
    alert(oldBGColor);
    alert(newBGColor);
    $('#second').css({'background-color': newBGColor});
}