Hi I am developing phonegap application. If I use console.log in index.html file then it prints, but If I use it in another file it doesn’t print. If suppose I import files in index.html file like:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.1.0.css" />
<link rel="stylesheet" href="docs/assets/css/jqm-docs.css" />
<link rel="stylesheet" href="docsdemos-style-override.css" />
<script type="text/javascript" charset="utf-8" src="cordova-1.6.1.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery-1.7.2.min"></script>
<script type="text/javascript" src="jquery.mobile/jqm.autoComplete-1.4.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery.mobile-1.1.0.js"></script>
<script type="text/javascript">
console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
</script>
</head>
<body>
<div data-role="page" id="home" data-add-back-btn="true">
<div data-role="content" >
<a href="UI/Equity/test.html" data-role="button" id="myButton">index</a>
</div>
</div>
</body>
</html>
Then page display with button and print !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. But on click of button it shows test.html file which is like:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.1.0.css" />
<link rel="stylesheet" href="docs/assets/css/jqm-docs.css" />
<link rel="stylesheet" href="docsdemos-style-override.css" />
<script type="text/javascript" charset="utf-8" src="cordova-1.6.1.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery-1.7.2.min"></script>
<script type="text/javascript" src="jquery.mobile/jqm.autoComplete-1.4.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery.mobile-1.1.0.js"></script>
<script type="text/javascript">
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
</script>
</head>
<body>
<div data-role="page" id="home" data-add-back-btn="true">
<div data-role="content" >
<a href="#" data-role="button" id="myButton">Test</a>
</div>
</div>
</body>
</html>
But here it doesn’t print @@@@@@@@@@@@@@@@@@@@@@@@@@@@ why is it so?
Check
PageCreateevent hereOR
Another option is to force refresh the page so the script in page 2 is executed, you can do this by setting:
Added data-ajax=”false”