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

时间:2015-09-06 10:40:03

标签: javascript jquery typeerror

我收到此错误。

  

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

我将版本更新为2.1.3

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

我收到了这个错误:

  

TypeError:$(...)。live不是函数

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

2 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分:1)

将您的代码.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+
});

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

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