简体   繁体   English

我如何修复错误 Uncaught ReferenceError: addEvent is not defined

[英]How can i fix the error Uncaught ReferenceError: addEvent is not defined

After changing my python and Django version I came up with the error of更改我的 python 和 Django 版本后,我想出了错误
Uncaught ReferenceError: addEvent is not defined . Uncaught ReferenceError: addEvent is not defined

The error took place at my DateTimeShortcuts.js file.错误发生在我的DateTimeShortcuts.js文件中。

The code raising the error is:引发错误的代码是:

addEvent(window, 'load', DateTimeShortcuts.init);
window.DateTimeShortcuts = DateTimeShortcuts;

This error prevents me for rendering correct a date widget that I am using for my Django app.此错误阻止我正确渲染我用于 Django 应用程序的日期小部件。

Any idea how to handle it?知道如何处理吗?

From commit into Django framework " Fixed #28536 -- Removed old JS cross-browser utilities " you can see that there were changes in that file.从提交到 Django 框架“ Fixed #28536 -- Removed old JS cross-browser utility ”,您可以看到该文件中有更改。

Try to run command that will refresh all static files:尝试运行将刷新所有静态文件的命令

python manage.py collectstatic

The problem is ' addEvent ' is not defined previously.问题是先前未定义“ addEvent ”。

Make sure that you have the definition of ' addEvent ' imported or written before this line.确保在此行之前导入或写入了“ addEvent ”的定义。

也许你应该写

window.addEventListener("load", ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复 Uncaught (in promise) ReferenceError: require is not defined with Vite? - How can I fix Uncaught (in promise) ReferenceError: require is not defined with Vite? 如何修复“ Uncaught ReferenceError:未定义firebase”错误? - How to fix “Uncaught ReferenceError: firebase is not defined” error? 如何修复“Uncaught ReferenceError: nameCheck is not defined”错误? - How to fix “Uncaught ReferenceError: nameCheck is not defined” error? 我无法修复此错误:未捕获的 ReferenceError:未定义模块 - I cannot fix this error: Uncaught ReferenceError: module is not defined 如何修复错误 Uncaught ReferenceError: require is not defined from readline function - how to fix error Uncaught ReferenceError: require is not defined from readline function 如何修复“未捕获的ReferenceError:未定义FB”? - How do I fix “Uncaught ReferenceError: FB is not defined”? 如何修复我的代码:错误:未捕获的 ReferenceError:未定义帐户? - How do I fix my code :error: Uncaught ReferenceError: account is not defined? 如何修复 ReferenceError: myFunction is not defined - How can I fix the ReferenceError: myFunction is not defined ReferenceError:未定义addEvent - ReferenceError: addEvent is not defined 如何修复未捕获的 ReferenceError:未定义 TimelineMax - How to fix Uncaught ReferenceError: TimelineMax is not defined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM