I have an input button with an initial background image. When a certain condition changes, I want to update its image using jQuery without overriding the button's global CSS in the stylesheet. Is there a way to only change the background attribute with jQuery or another method? Thank you.
JS:
if(sum>=window.start_fee){
$(".shopcart").removeAttr("disabled")
$(".shopcart").css("background", 'url(/static/images/cart2.png)')
}else{
$(".shopcart").attr("disabled","disabled")
$(".shopcart").css("background", 'url(/static/images/cart.png)')
}
CSS:
.shopcart{
background:url(/static/images/cart.png) no-repeat;
border:none;
background-size:100% 100%;
width:57px; height:50px;
float:right;
}