My webpage has a div element that I want to be able to change the background color of by clicking on it. The background should either be transparent with no color, or a reddish/pinkish shade.
I've written a javascript function to handle this functionality, where it checks the current background color and toggles it accordingly:
if (buttonBackground == "transparent") {
//"rgba(0, 0, 0, 0)") {
$('#delete_button_container_' + buttonNumber).css('background-color', '#ff9494');
} else if (buttonBackground == "rgb(255, 148, 148)") {
$('#delete_button_container_' + buttonNumber).css('background', 'none');
}
The issue I'm facing is that Chrome reads the background-color property for transparent as "rgba(0, 0, 0, 0)"
while Firefox reads it as "transparent"
. However, both browsers interpret the reddish/pinkish color '#ff9494' as "rgba(0, 0, 0, 0)"
This discrepancy is causing a problem where the functionality works in one browser but not the other. Any suggestions or solutions on how to resolve this issue?