【发布时间】:2018-04-15 19:47:18
【问题描述】:
我正在使用带有 atom 编辑器的 phonegap,但我的 jquery 和 jquery mobile 无法正常工作。所有 .js 文件都在一个名为 js 的文件夹中,并且根目录已正确链接。我已经尝试了在线 code.jquery.com 版本,但它仍然无法正常工作。这些是我尝试过的 2 个版本:
版本 1
`<link rel="styleheet" type="text/css" href="css/jquery.mobile-
1.4.5.min.css">
<link rel="styleheet" type="text/css" href="css/jquery.mobile-1.4.5.css">
<link rel="stylesheet" type="text/css" href="css/index.css" />
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript"> app.initialize();</script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js">
</script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.js"></script>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
`
版本2
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"/>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-
1.4.5.min.js"></script>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">app.initialize();</script>
我使用这段代码来测试我的 jquery 是否正常工作
`<script>
window.onload = function(){
if (window.jquery){
alert("YES");
}else {
alert("ERROR");
}
}
</script>
`
而且每次都出现错误。我编程并没有出现 YES ERROR:
【问题讨论】:
标签: jquery cordova jquery-mobile atom-editor phonegap