1

I'm following the getting started code,

this is the code,

<!DOCTYPE html>

 <html>
<head>
    <title>jQuery Mobile</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, 
    initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
    <link href="lib/jquery/jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css" />
    <script src="lib/jquery/jquery.mobile-1.3.2.js"></script>
    <script src="lib/jquery/jquery-1.9.1.js"></script>

</head>
<body>
    <div data-role="page">
        <div data-role="header">
            <h1>HOME</h1>
        </div>
    </div>
    <div data-role="content">
        <a href="02_menuform.html" data-role="button">MENU</a>
        <a href="02_busform.html" data-role="button">BUS</a>
        <a href="02_restaurantform.html" data-role="button">RESTAURANT</a>
    </div>
</body>
</html>

but i have an error like this,

Uncaught TypeError: Cannot set property 'mobile' of undefined jquery.mobile-1.3.2.js:26
 (anonymous function) jquery.mobile-1.3.2.js:26
(anonymous function) jquery.mobile-1.3.2.js:27
(anonymous function) jquery.mobile-1.3.2.js:22
(anonymous function) jquery.mobile-1.3.2.js:24

and it doesn't apply the jquery mobile style sheet(button and css kind of stuff)

what is the problem?

Canna
  • 3,614
  • 5
  • 28
  • 33

1 Answers1

7

You need to place your jquery before mobile js.

Replace

<script src="lib/jquery/jquery.mobile-1.3.2.js"></script>
<script src="lib/jquery/jquery-1.9.1.js"></script>

with

<script src="lib/jquery/jquery-1.9.1.js"></script>
<script src="lib/jquery/jquery.mobile-1.3.2.js"></script>

Also, ideally your <div data-role="content"> should be part of the <div data-role="page">.

Sudipta Chatterjee
  • 4,592
  • 1
  • 27
  • 30
Dipesh Parmar
  • 27,090
  • 8
  • 61
  • 90