I'm using JQuery mobile on Apache Cordova for android. Javascript between the body tags works, but javascript files that I link to in the header don't execute, even on the first page loaded.
I read a lot about problems with JQuery loading javascript due to the way ajax parses linked pages - however in this case embedded javascript isn't even working on the main page, and I can't find any answers to this problem
Here is index.js:
$(document).ready(function() {
// Handler for .ready() called.
document.addEventListener("deviceready", onDeviceReady, true);
});
function onDeviceReady() {
alert('index js loaded successfully');
}
And here is index.html. The alert('index') works but alert('index js loaded successfully') does not appear
<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" />
<link rel="stylesheet" href="css/jquery.mobile-1.4.0.css" />
</head>
<body>
<script type="text/javascript">alert('index');</script>
<script src="js/jquery-1.11.0.js"></script>
<script src="js/cordova.js"></script>
<script src="js/index.js"></script>
<script src="js/jquery.mobile-1.4.0.js"></script>
<!-- Start of first page: #one -->
<div data-role="page" id="one">
<div data-role="header">
<h1>Main Menu</h1>
</div><!-- /header -->
<div data-role="content" >
<p> content here </p>
</div><!-- /content -->
<div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div>
</body>
</html>