0

我的程序使用 jquery.gritt 插件来显示错误和成功消息。在整个应用程序中运行良好。但仅在一处显示以下代码的“无法读取未定义的属性‘添加’”:

$(".cart").on("click", function(){
        if($("#cartCount").html()==""){
            $.gritter.add({
                title: "Cart",
                text: "Cart is empty", class_name: 'gritter-red',
                fade_in_speed: 100, fade_out_speed: 100,
                sticky: true, time: '2000'
            });
        }
    });

我在 header.jsp 中有这段代码,并且 header.jsp 包含在主页上。主页上有 jquery.gritt.js 的导入。

主页还有其他包含的 jsp 页面,我们在其中使用了 gritter 功能并且它们工作正常。我也尝试在 header.jsp 中包含 grutter 插件,但它不起作用。我的应用程序是一个 Spring MVC 应用程序。

如何解决?

4

0 回答 0