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

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

问题描述

我只是在学习如何编写 Javascript.有人告诉我这是如何包含 jquery 和 jquery mobile:

<头><link rel="样式表"href="css/jquery.mobile-1.4.5.min.css"><script src="scripts/jquery-3.0.0.min.js"><脚本src="scripts/jquery.mobile-1.4.5.min.js"><身体><div data-role="页面"><div data-role=header>我的页面</div><div data-role="内容"><label for="entry">输入一个数字:</label><input type='number' name='entry' id='entry' min='0'><button>我的按钮</button>

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

解决方案

jQuery 3 是 五天大.它也破坏了一些事情.jQuery Migrate,在前面的两个链接中都提到过,可能会使您的设置正常工作,但请考虑不要过度使用它踪迹.

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.

解决方案

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天全站免登陆