未捕获的TypeError:$(…)。tooltip不是函数

我有一个基于Spring Web模型 – 视图 – 控制器(MVC)框架的项目。 在WebLogic Server版本上部署的Spring Web模型 – 视图 – 控制器(MVC)框架版本为3.2.8:12.1.2.0.0

我有这个错误加载1 JSP

未捕获的TypeError:$(…)。tooltip不是一个函数

这是我加载的所有内容,我逐一检查并加载了所有内容

            $(document).ready(function() { $('[data-toggle="tooltip"]').tooltip(); var selected = []; var table = $('#example').DataTable({ "dom": 'rt', "autoWidth": false, "paging": false, "scrollX": false, "scrollY": 300, "scrollCollapse": true, "rowCallback": function(row, data) { if ($.inArray(data.DT_RowId, selected) !== -1) { $(row).addClass('selected'); } }, "columnDefs": [{ "targets": 'nosort', "orderable": false }, ] }); $('#example tbody').on('click', 'input', function() { $(this).closest("tr").toggleClass('selected'); if ($(this).is(':checked')) { var theNameOfSelectedProduct = $(this).closest("tr").find("td.productname").text(); $('#selecteddevices').val($('#selecteddevices').val() + " " + theNameOfSelectedProduct); $('#actions4devices button').removeAttr("disabled"); } else { var theNameOfSelectedProduct = $(this).closest("tr").find("td.productname").text(); $('#selecteddevices').val($('#selecteddevices').val().replace(theNameOfSelectedProduct, "")); if ($('#selecteddevices').val().trim().length == 0) { $('#actions4devices button').not('.pull-right').attr("disabled", "disabled"); } } }); $('#refusedevicesButtonId').on('click', function() { $('#theRefuseFile').show(); }); });  

我们能看到你在哪里使用$.tooltip()吗? 它有可能发生在jQuery UI嵌入行之前的某个地方。 所以尝试重新安排你的脚本包括所以jQuery是第一个,jQuery UI是第二个,然后是其余的。

       

很难知道没有看到您的完整代码并知道哪些文件包含您对$.toolTip()调用。

另一个快速尝试是将jQuery替换为您正在使用的$ ,即:

$(".tips").toolTip()

会成为:

jQuery(".tips").toolTip()

这可能是由于jQuery的版本。 至少是我和我解决了这个问题。 我使用的是jQuery 3.3.1。 当我将django更改为1.10.3时,问题解决了。 加上这个,

http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js

它需要工作。

请注意, jquery-ui有自己的.tooltip()函数, Bootstrap也有。

尝试重新排序你的js文件,如