错误:Bootstrap 的 JavaScript 需要 jQuery 1.9.1 或更高版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32422656/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 15:15:05  来源:igfitidea点击:

Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher

javascriptjquerytypeerror

提问by Sunil Shrestha

I am getting this error.

我收到此错误。

Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher

错误:Bootstrap 的 JavaScript 需要 jQuery 1.9.1 或更高版本

And I update the version into 2.1.3 that is

我将版本更新为 2.1.3

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

And I get this error:

我收到这个错误:

TypeError: $(...).live is not a function

类型错误:$(...).live 不是函数

I don't know how to solve this issue. Please suggest me.

我不知道如何解决这个问题。请建议我。

采纳答案by Sagi

Live is deprecated from 1.7 and removed from 1.9 Just use onor delegate.

Live 已从 1.7 弃用并从 1.9 中删除只需使用ondelegate

$( "[selector]").on("events" [, selector ] [, data ], function() {
   ....
});

回答by Nicolapps

Replace in your code .live()by .on():

在您的代码中替换.live().on()

$( selector ).live( events, data, handler );                // jQuery 1.3+
$( document ).delegate( selector, events, data, handler );  // jQuery 1.4.3+
$( document ).on( events, selector, data, handler );        // jQuery 1.7+


$( "a.offsite" ).live( "click", function() {
  alert( "Goodbye!" ); // jQuery 1.3+
});
$( document ).delegate( "a.offsite", "click", function() {
  alert( "Goodbye!" ); // jQuery 1.4.3+
});
$( document ).on( "click", "a.offsite", function() {
  alert( "Goodbye!" );  // jQuery 1.7+
});

Source : http://api.jquery.com/live/

来源:http: //api.jquery.com/live/

You can try to update Bootstrap to the lastest version too.

您也可以尝试将 Bootstrap 更新到最新版本。