Bootstrap的JavaScript需要jQuery版本1.9.1或更高版本,但低于版本3 [英] Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3
问题描述
简介
我正在使用bootstrap框架。我目前正在使用Bootstrap Tabs(隐藏/显示).I我正在使用bootstrap版本3和jquery版本3.0.2。
I am working with the bootstrap framework.I am currently working on "Bootstrap Tabs"(hide/show).I am using bootstrap version 3 and jquery version 3.0.2 something.
问题
我的标签不起作用,除非我加载小于1.6的版本的jquery。但是然后ajax使jquery小于1.6的问题。 Chrome控制台给我这个错误。
My tabs are not working, unless i load jquery of version less than 1.6.But then ajax making problem with jquery less than 1.6. Chrome console give me this error.
bootstrap.min.js:6未捕获错误:Bootstrap的JavaScript需要
jQuery版本1.9。 1或更高,但低于版本3
bootstrap.min.js:6 Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3
我尝试了不同的回退技术但无法正确实现。
I tried different fallback techniques but couldn't implement correctly.
我被困在这里2天,如果有人有任何想法或任何参考,请帮忙。谢谢你的时间。
I am stuck here for 2 days, if someone have any idea or any reference, please do help.Thanks for your time.
推荐答案
目前Bootstrap 3.x不支持此处报告的jQuery 3.x: https://github.com/twbs/bootstrap/issues/16834
Currently Bootstrap 3.x does not support jQuery 3.x as reported here: https://github.com/twbs/bootstrap/issues/16834
问题是由以下原因造成的:
The issue is caused by:
jQuery 3比jQuery 2更严格。它就像XHTML和HTML。
保留向后兼容性,代码看起来不是一团糟。
如果我没弄错的话,你需要做的就是用.css('display','')或addClass('hidden')替换show()和hide()
函数并修复alert.js中的
选择器(此行上的QUnit失败,因为$('#')在jQuery 3中是
无效)
jQuery 3 is more strict than jQuery 2. It's like XHTML and HTML. Backward compatibility is preserved and code doesn't look like a mess. If I'm not mistaken, all you need to do is replace show() and hide() functions with .css('display', '') or addClass('hidden') and fix a selector in alert.js (QUnit fails on this line because $('#') is invalid in jQuery 3)
它在Bootstrap 3.3.7版本中得到修复: https ://github.com/twbs/bootstrap/issues/16834#issuecomment-225039913
It is fixed in the Bootstrap 3.3.7 release: https://github.com/twbs/bootstrap/issues/16834#issuecomment-225039913
这篇关于Bootstrap的JavaScript需要jQuery版本1.9.1或更高版本,但低于版本3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!