Im using a WP plugin wich enqueues a js file. Today i saw a the following error in the console
User2.Roles{"FirstAppAdmin","SecondAppAdmin"}
After deactivating the plugin and activating it again the error is gone. Usually “jQuery is not defined” is a sign jQuery is being called incorrectly. I cheked the code and cant find any error. Any idea how to avoid this kind of error or is there any error in the following code?
jquery is not defined...
答案 0 :(得分:0)
错误似乎出现在jQuery插件上,因为您已经通过wp_enqueue_script指定该文件需要jquery。这可能是很多事情,也许它与其他一些图书馆相冲突。
尝试在文件开头为jQuery声明一个新别名,然后用新别名替换所有jQuery或$。像这样:
var newAlias = jQuery.noConflict();
newAlias(document).ready(function()...
希望它可以提供帮助!