Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery 3.0.0 incompatible with Jquery Mobile?

I'm just learning how to write Javascript. I've been told that this is how to include jquery and jquery mobile:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet"   
      href="css/jquery.mobile-1.4.5.min.css">
  <script src="scripts/jquery-3.0.0.min.js">
  </script>
  <script 
    src="scripts/jquery.mobile-1.4.5.min.js">
  </script>
</head>
<body>
  <div data-role="page">
    <div data-role=header>My Page</div>
    <div data-role="content">
      <label for="entry">Enter a number:</label>
      <input type='number' name='entry' id='entry' min='0'>
      <button>My button</button>
    </div>
  </div>
</body>
</html>

The page above doesn't render mobile styles; it just looks like plain html. But if I change the jquery library to 2.2.4 (both are present in the scripts folder) it works and the text box and button look like a mobile app with no errors in the console. Is there some incompatibility here? Also, when I use 3.0.0 the console says: TypeError: a.event.props is undefined. I'm just curious as to what's going on here and why I have to use the older jquery.

like image 896
user332521 Avatar asked Jun 14 '16 20:06

user332521


2 Answers

According to this message on jquery-mobile github issue-tracker jquery-mobile version 1.5 should be compatible with jQuery 3.x.

It is not available at the main website at the moment, but is available at code.jquery.com

like image 61
PF4Public Avatar answered Sep 22 '22 13:09

PF4Public


jQuery 3 is all of five days old. It also broke some things. jQuery Migrate, mentioned in both previous links, MIGHT make your setup work, but consider not blazing this trail.

like image 39
Matt Schuette Avatar answered Sep 18 '22 13:09

Matt Schuette