Reputation: 21
I am trying to build a very simple android application using phonegap along with eclipse.I am very new to phonegap . When i run the application the page gets displayed in the emulator but my javascript alert function is not working.Can someone please help me ?? Here is my index.html file.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady()
{
alert('hello');
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
</div>
<div data-role="content">
<p>Hello Phonegap!!</p>
</div>
<div data-role="footer">
<h1>Footer Text</h1>
</div>
</div>
</body>
</html>
Upvotes: 2
Views: 2266
Reputation: 6551
Add this phonegap version tag in your html page.
<script src="cordova-x.x.x.js" charset="utf-8" type="text/javascript"></script>
Without this, phonegap events will not work on your page.
Upvotes: 2