Javascript PhoneGap jquery移动错误:未定义未捕获引用错误:$
我正在开发我的第一个phoneGap应用程序,我在使用jquery mobile时遇到了问题,我已经下载了jquery mobile和 我正在尝试将页面划分为4个分区,每个分区都有特定的颜色,并在单击其中任何一个分区时打印警报。 这是我在index.html中的代码:Javascript PhoneGap jquery移动错误:未定义未捕获引用错误:$,javascript,jquery,cordova,jquery-mobile,phonegap-plugins,Javascript,Jquery,Cordova,Jquery Mobile,Phonegap Plugins,我正在开发我的第一个phoneGap应用程序,我在使用jquery mobile时遇到了问题,我已经下载了jquery mobile和 我正在尝试将页面划分为4个分区,每个分区都有特定的颜色,并在单击其中任何一个分区时打印警报。 这是我在index.html中的代码: <!DOCTYPE html> <!-- Copyright (c) 2012-2014 Adobe Systems Incorporated. All rights reserved. Lic
<!DOCTYPE html>
<!--
Copyright (c) 2012-2014 Adobe Systems Incorporated. All rights reserved.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<style>
.camArea
{
width: 50%;
float:left;
background: red;
height: 100%;
}
.camSection
{
width:100%;
height: 50%;
}
.camContainer
{
width: 100%;
height: 100%;
position:fixed;
}
</style>
</head>
<body>
<div class="app">
<div class="camContainer">
<div class="camSection">
<div class="camArea" style = "background:blue" ></div>
<div class="camArea" style = "background:#ff4512"></div>
</div>
<div class="camSection">
<div class="camArea" style = "background:green"></div>
<div class="camArea" style = "background:#34d3ff"></div>
</div>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
$(".camArea").click(function(){
alert("Toto")
});
</script>
</body>
</html>
这就是我的应用程序在出现错误时的样子
当我点击查看错误时,我看到了这个
当我试图通过在控制台上写入$来检查它是否存在时,我得到了以下结果
function $(selector, [startNode]) { [Command Line API] }
这就是图像
当我试着把这条线包括进去的时候
<script type="text/javascript" src="jquery/jquery.mobile-1.4.5.min.js"></script>
在
我收到以下错误:未捕获类型错误:无法设置未定义的属性“mobile”
图为:
有人能帮忙吗?错误:
$ is not defined
是不包括jquery.js文件的一般消息
它与jquery移动引用不同
因此,只需在jquery移动引用文件的头和前面插入jquery.js即可
$ is not defined