After creating a function to set a background on a click event, I encountered an issue. I attempted two different methods, expecting both to be successful. However, only the .css() version worked while the addClass method failed. Why is this happening?
function changeBackground(e){ $("#" + e).css('backgroundColor', '#444444');}
function addClassName(e){$("#" + e.id).addClass('clickColor');}
Below is the CSS for the clickColor class:
.clickColor{
backgroundColor: #444444;
}