0
我正在嘗試獲取phonegap 3.0來加載jquery並沒有發生任何事情。Jquery無法在Phonegap 3.0上工作
例如這個工程:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<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>
</head>
<body>
<div class="app">
<input type="button" value="click me" id="myButton" onclick="alert('hello')" />
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</body>
</html>
但這並不:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<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>
</head>
<body>
<div class="app">
<input type="button" value="click me" id="myButton" />
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
app.initialize();
$(document).ready(function(){
$('#myButton').click(function(){
alert('hello');
});
});
</script>
</body>
</html>
我不能爲我的生活想出解決辦法。我有正確的目錄中的jQuery
定義「不起作用」。 – melancia
請參閱控制檯並告訴我們您可以在那裏看到(f12 if chrome,ie) – Misters