【发布时间】:2014-06-18 16:00:03
【问题描述】:
我正在使用
为元素设置背景background: url("../img/mapfield-icon.png");
我正在尝试在事件发生时使用 jquery 切换元素。这是我正在使用的代码。
$('#zipCodeBtn').css({ background: 'url("../img/mapfield-icon_yellow.png")'});
当它查找文件时,它没有找到它。这就是 Inspect Element 中出现的内容
background: url(file:///img/mapfield-icon_yellow.png);
【问题讨论】:
-
你需要确保图片的url是正确的。如果您将项目部署在 tomcat 上,您的项目应该位于 webapps 文件夹中。