jgrowl中的jquery奇怪的错误

时间:2010-02-20 21:48:47

标签: jquery jquery-ui jquery-plugins jquery-selectors

所有

我使用jgrowl显示某些内容,我今天遇到了这个奇怪的错误

$(this).data("jGrowl") is undefined in jquery.jgrowl_compressed.js file in line 59

这指向了我的后续行,

$(this).data("jGrowl").created=new Date();

在我的项目js文件中,我有以下代码

if (data)
{
 $('.jGrowl-notification:contains("' + oldtext + '")').remove();
 $.jGrowl.defaults.poll = 1;
 $.jGrowl(data, { animateOpen: { height: 'show'}, glue : 'after' , position : 'bottom-right'});
  oldtext=data;
  clean();
 }

 function clean()
 {
  $('.jGrowl-notification:contains("' + oldtext + '")').remove();
 }

我在尝试打开菜单时遇到错误,在打开菜单之前我再次打开它..

知道可能出现的问题。

感谢。

1 个答案:

答案 0 :(得分:2)

根据the API for .data(),语法应该是$(this).data("jGrowl_created", new Date());或类似的东西。也许你更想要$(jGrowlElement).data("created", new Date()");