本文介绍了缺少jQuery中的步骤并得到"ReferenceError:$未定义".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个script.js页面

i have a script.js page

$(document).ready(function () {

//errortrap
function alerts(str) {
    return false;
}
//errortrap

//lightbox
$('.LikeDiv').lightBox({ openPop: '.rename', closePop: '.cloSign', centerAlign: true });
//lightbox
});

function lightboxopen() {

$('.LikeDiv').load('subscriberforgotpassword.aspx');
return false;
}

function showLightBox() {

$('.rename').trigger('click');
}

即使在$存在之后,我也收到此错误"ReferenceError:未定义$".谁能告诉我如何解决这个错误.

I am getting this error 'ReferenceError: $ is not defined' even after the $ is present.can anyone tell me how to solve this error.

推荐答案

$(document)不保证已加载该事实.为此,您将需要:

$(document) does not guarantee the fact that it is loaded. to do this, you'll need to either:

  • 以传统方式绑定DOM
  • 包装瓶盖
  • 确保脚本是在jQuery之后加载的(即,其脚本标签位于之后)

这篇关于缺少jQuery中的步骤并得到"ReferenceError:$未定义".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 19:50