score:1

Accepted answer

With jQuery mobile you need to put your page specific scripts and styles inside the page-content div. See "Known Limitations" in documentation.

score:1

I have tried what Tsar mentioned and for me it worked. What I did was:

Added the script within the head tag, and added the div with the ID(rederTo) used in the script within the "page-content".

<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Acura</title>
<link href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
<script src="libs/hightcharts/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

    <script type="text/javascript">
        var chart1; // globally available
$(document).ready(function() {
      chart1 = new Highcharts.Chart({
         chart: {
            renderTo: 'container',
            type: 'bar'
         },
         title: {
            text: 'Fruit Consumption'
         },
         xAxis: {
            categories: ['Apples', 'Bananas', 'Oranges']
         },
         yAxis: {
            title: {
               text: 'Fruit eaten'
            }
         },
         series: [{
            name: 'Jane',
            data: [1, 0, 4]
         }, {
            name: 'John',
            data: [5, 7, 3]
         }]
      });
   });
    </script>
</head>

<body>

<div id="ge" data-role="page">
    <div data-role="header">
        //header
    </div>
    <div data-role="content">
        <div id="container"></div>
    </div>
</div>
</body>
</html>

score:4

I had this same problem when I first started coding with jQuery Mobile... You have to bind your scripts on pagecreate, ie:

$(document).delegate("#page-id", "pagecreate", function() {
    // highcharts, etc.
}

Related Query

More Query from same tag