bootstrap 2.3 模式和自动完成的问题
Trouble with bootstrap 2.3 modal and autocomplete
我正在使用 bootstrap 2.3 构建我的站点,并使用自动完成 jquery 从数据库中获取数据并在文本框中向用户建议选项。我在 jquery 到 运行 的 bootstrap 模式和 [自动完成 jquery 插件][1] 的正确版本上遇到了问题。
如果我有 jquery 1.1,bootstrap 模态可以完美运行,但自动完成插件无法运行,会出现以下错误:
Uncaught TypeError: Cannot read property 'opera' of undefined
另一方面,如果我使用 1.1 以上的 jquery 版本,自动完成将起作用,而 bootstrap 模态将不起作用,给我一堆错误:
Uncaught TypeError: t(...).on is not a function(anonymous function) @ bootstrap-min.js:11(anonymous function) @ bootstrap-min.js:11
bootstrap-alert.js:97 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-alert.js:97(anonymous function) @ bootstrap-alert.js:99
bootstrap-button.js:99 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-button.js:99(anonymous function) @ bootstrap-button.js:105
bootstrap-carousel.js:192 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-carousel.js:192(anonymous function) @ bootstrap-carousel.js:207
bootstrap-collapse.js:157 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-collapse.js:157(anonymous function) @ bootstrap-collapse.js:167
bootstrap-dropdown.js:164 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-dropdown.js:164(anonymous function) @ bootstrap-dropdown.js:169
bootstrap-modal.js:232 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-modal.js:232(anonymous function) @ bootstrap-modal.js:247
bootstrap-scrollspy.js:155 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-scrollspy.js:155(anonymous function) @ bootstrap-scrollspy.js:162
bootstrap-tab.js:139 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-tab.js:139(anonymous function) @ bootstrap-tab.js:144
bootstrap-typeahead.js:329 Uncaught TypeError: $(...).on is not a function
[1]: https://jqueryui.com/autocomplete/
我相信我已将文件按正确的顺序放在页脚的 </body>
标记之前。这是代码:
<script src="<%=request.getContextPath() %>/setup/include/js/jquery/jquery-1.4.2.min.js"></script>
<script src="<%=request.getContextPath() %>/setup/include/js/jquery/jquery.autocomplete.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-min.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-alert.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-button.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-carousel.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-collapse.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-dropdown.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-modal.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-scrollspy.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-tab.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-tooltip.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-transition.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-typeahead.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/jquery/jquery-linedtextarea.js"></script>
<script type="text/javascript">
$(function() {
// Target all classed with ".lined"
$(".lined").linedtextarea(
{selectedLine: 0}
);
// Target a single one
$("#mytextarea").linedtextarea();
});
</script>
<script>
jQuery(function(){
$("#getValues").autocomplete("/sfs/getIdsServlet");
});
</script>
谁能告诉我问题出在哪里?
工作一周后,我在某处读到使用 jquery 1.7.2 解决了某人的问题,这也帮助了我!我用的很多其他版本的jQuery都无法解决!
我正在使用 bootstrap 2.3 构建我的站点,并使用自动完成 jquery 从数据库中获取数据并在文本框中向用户建议选项。我在 jquery 到 运行 的 bootstrap 模式和 [自动完成 jquery 插件][1] 的正确版本上遇到了问题。
如果我有 jquery 1.1,bootstrap 模态可以完美运行,但自动完成插件无法运行,会出现以下错误:
Uncaught TypeError: Cannot read property 'opera' of undefined
另一方面,如果我使用 1.1 以上的 jquery 版本,自动完成将起作用,而 bootstrap 模态将不起作用,给我一堆错误:
Uncaught TypeError: t(...).on is not a function(anonymous function) @ bootstrap-min.js:11(anonymous function) @ bootstrap-min.js:11
bootstrap-alert.js:97 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-alert.js:97(anonymous function) @ bootstrap-alert.js:99
bootstrap-button.js:99 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-button.js:99(anonymous function) @ bootstrap-button.js:105
bootstrap-carousel.js:192 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-carousel.js:192(anonymous function) @ bootstrap-carousel.js:207
bootstrap-collapse.js:157 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-collapse.js:157(anonymous function) @ bootstrap-collapse.js:167
bootstrap-dropdown.js:164 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-dropdown.js:164(anonymous function) @ bootstrap-dropdown.js:169
bootstrap-modal.js:232 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-modal.js:232(anonymous function) @ bootstrap-modal.js:247
bootstrap-scrollspy.js:155 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-scrollspy.js:155(anonymous function) @ bootstrap-scrollspy.js:162
bootstrap-tab.js:139 Uncaught TypeError: $(...).on is not a function(anonymous function) @ bootstrap-tab.js:139(anonymous function) @ bootstrap-tab.js:144
bootstrap-typeahead.js:329 Uncaught TypeError: $(...).on is not a function
[1]: https://jqueryui.com/autocomplete/
我相信我已将文件按正确的顺序放在页脚的 </body>
标记之前。这是代码:
<script src="<%=request.getContextPath() %>/setup/include/js/jquery/jquery-1.4.2.min.js"></script>
<script src="<%=request.getContextPath() %>/setup/include/js/jquery/jquery.autocomplete.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-min.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-alert.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-button.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-carousel.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-collapse.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-dropdown.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-modal.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-scrollspy.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-tab.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-tooltip.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-transition.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/bootstrap/bootstrap-typeahead.js"></script>
<script src="<%=request.getContextPath()%>/setup/include/js/jquery/jquery-linedtextarea.js"></script>
<script type="text/javascript">
$(function() {
// Target all classed with ".lined"
$(".lined").linedtextarea(
{selectedLine: 0}
);
// Target a single one
$("#mytextarea").linedtextarea();
});
</script>
<script>
jQuery(function(){
$("#getValues").autocomplete("/sfs/getIdsServlet");
});
</script>
谁能告诉我问题出在哪里?
工作一周后,我在某处读到使用 jquery 1.7.2 解决了某人的问题,这也帮助了我!我用的很多其他版本的jQuery都无法解决!