我使用bootstrap 2.3构建我的站点和自动完成jquery来从数据库中获取数据并在文本框中向用户建议选项。我正在使用正确的jquery版本来运行bootstrap模式和[autocomplete 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>
有人可以建议问题可以解决吗?
答案 0 :(得分:0)
在为WEEK工作之后,我在某处读到了使用jquery 1.7.2为某人解决了问题,这也帮助了我!我使用的许多其他版本的jQuery都无法解决它!