Jquery 3.0.0 incompatible with Jquery Mobile?

允我心安 提交于 2019-12-29 07:43:45

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/37821393/jquery-3-0-0-incompatible-with-jquery-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!