Incompatible jquery mobile and ui

Although I have tons of people linking to similar compatibility issues, 50% of their issues are solved on StackOverflow. I hope my question does it 51-49 :)

Consider this code:

<html>
<head>
  <title>Hello, world!</title>
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
  <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
  <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
</head>
<body>
  Hello
</body>
</html>

      

If you load this on a webpage, you will get a gray circle in the middle of your browser and the word "Hello" will not be displayed. On the web console, you will see the following: Uncaught TypeError: Object 0 has no 'match' method (Chrome) or TypeError: c.match is not a function (Firefox) or SCRIPT438: Object does not support 'match' property or method (IE).

Is it a good idea to use jquery-ui and jquery-mobile on the page together, or am I doing something wrong?

+3


source to share


1 answer


The only thing that matters is the order, jQM loading after jUI, the same happens for css files:

<!DOCTYPE html>
<html>
<head>
  <title>jQM Complex Demo</title>
  <meta name="viewport" content="width=device-width"/>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />    
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
  <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
  <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>    
  <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
    <div data-role="page" id="index">    
      Hello
    </div>
</body>
</html>

      

Also you need:



<!DOCTYPE html>

      

And this will prevent the ajax loader from failing:

<div data-role="page" id="index">    
    Hello
</div>

      

+9


source







All Articles