如何删除background-image属性? [英] How can I remove a background-image attribute?
本文介绍了如何删除background-image属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个代码:
if (pansel.val() == "1")
$(#myDiv).css('background-image', 'url(/private_images/guida_check_category.jpg)');
else
$(#myDiv).css({ 'background-color': '#ffffff' });
我看到,当我应用background-image时,代码如下:
and I see that, when I apply the background-image, the follow code :
$(#myDiv).css({ 'background-color': '#ffffff' });
不会移除图片并放上白色背景颜色。图像仍然存在!
doesnt remove the image and put the white background color. The image still present!
如何完全删除background-image属性?
How can I totally remove that background-image attribute?
推荐答案
尝试:
if (pansel.val() == "1")
$("#myDiv").css('background-image', 'url(/private_images/guida_check_category.jpg)');
else {
$("#myDiv").css({ 'background-color': '#ffffff' });
$("#myDiv").css('background-image', 'none');
}
这篇关于如何删除background-image属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文