I've a input a button which have a initial background image. I tried to change its image when some condition changed with jquery .css(). It seems that it will override the button's global css in css file. How can I only change background attribute with jquery or anything else? Thanks.
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;
}