jQuery 3.0.0与Jquery Mobile不兼容吗? [英] Jquery 3.0.0 incompatible with Jquery Mobile?

查看:191
本文介绍了jQuery 3.0.0与Jquery Mobile不兼容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习如何编写Javascript.有人告诉我这是如何包括jquery和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>

以上页面未呈现移动样式;它看起来像纯HTML.但是,如果我将jquery库更改为2.2.4(两者都存在于scripts文件夹中),它将起作用,并且文本框和按钮看起来像一个移动应用程序,控制台中没有错误.这里有一些不兼容吗?另外,当我使用3.0.0时,控制台会说:TypeError:a.event.props是未定义的.我只是想知道这里发生了什么以及为什么我必须使用旧的jquery.

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.

推荐答案

jQuery 3是一些东西.在前面两个链接中提到的 jQuery Migrate 可以使您的设置正常进行,但请考虑不要这样做足迹.

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.

这篇关于jQuery 3.0.0与Jquery Mobile不兼容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆