Reputation: 2550
I am attempting to learn how to use jQuery mobile and phonegap together. I have the following basic index page:
<!DOCTYPE html>
<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" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.external-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.icons-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-svg-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.4.3.css" />
<title>UIAdv</title>
</head>
<body>
<div class="app">
<h1>Welcome to UIAdv</h1>
<a href="#" class="ui-btn ui-btn-inline">Anchor</a>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.3.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</body>
</html>
In there I have the following line which is supposed to render a button using jquery library:
<a href="#" class="ui-btn ui-btn-inline">Do Something</a>
When the application is run using phonegap run ios and build is successful, I get the attached image output:
Whereas the button should look like this:
When I open the index.html in a browser (inside the directory of phonegap app), I get the following in console:
And I am guessing this is causing the problem. I need your support to solve this first-encounter problem (to myself). I downloaded all jQuery mobile zip file and placed all files within in respective folders in the phonegap app.
Thanks,
Upvotes: 0
Views: 708
Reputation: 3330
The cordova.js
script tag should be in the header. Also you need to check that the cordova.js
file is present in the www
directory of the app. I have rewritten the html file. You can use the code below to test your jquery mobile app. Happy coding!!!
<html>
<head>
<title>UIAdv</title>
<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" /-->
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.external-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.icons-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-svg-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.4.3.css" />
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.3.js"></script>
<!-- script type="text/javascript" src="js/index.js"></script -->
<!-- script type="text/javascript"> app.initialize(); </script -->
</head>
<body>
<div class="app">
<h1>Welcome to UIAdv</h1>
<a href="#" class="ui-btn ui-btn-inline">Anchor</a>
</div>
</body>
</html>
Upvotes: 1