Uncaught TypeError: $(…).tooltipster is not a function [duplicate]

荒凉一梦 提交于 2019-12-12 05:58:59

问题


I can't use the tooltipster library along with tablesorter one as it throws an error:

Uncaught TypeError: $(...).tooltipster is not a function

And my code:

<html><head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script>
<script type="text/javascript" src="llibreries/tooltipster/dist/js/tooltipster.bundle.min.js"></script>
<link rel="stylesheet" href="css/jq.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="themes/blue/style.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="css/vista.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="llibreries/tooltipster/dist/css/tooltipster.bundle.min.css" />

<script type="text/javascript">
        $(document).ready(function() {
                $('.tooltip').tooltipster({
        contentCloning: false
        });
        });
</script>

<script type="text/javascript" src="llibreries/jquery-latest.js"></script> 
<script type="text/javascript" src="llibreries/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/docs.js"></script>
<script type="text/javascript" src="addons/pager/jquery.tablesorter.pager.js"></script>

    <script type="text/javascript">
        $(function() 
    {
                $("table")
                .tablesorter({widthFixed: true, widgets: ['zebra']})
                .tablesorterPager({container: $("#pager")
    });
    });
    </script></head> ....

If I comment the second script $("table").tablesorter... The tooltip script works. Otherwise, it doesn't. Can't make it work, what am I doing it wrong?


回答1:


Please check the links for the CDN embedded in the header

Please check the link CDN for the Tooltipster.

This is wrong

<script type="text/javascript" src="llibreries/tooltipster/dist/js/tooltipster.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="llibreries/tooltipster/dist/css/tooltipster.bundle.min.css" />

Try this

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.js"></script>

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/tooltipster.min.css" />

<html><head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.js"></script>
<link rel="stylesheet" href="css/jq.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="themes/blue/style.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="css/vista.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/tooltipster.min.css" />

<script type="text/javascript">
        $(document).ready(function() {
                $('.tooltip').tooltipster({
        contentCloning: false
        });
        });
</script>

<script type="text/javascript" src="llibreries/jquery-latest.js"></script> 
<script type="text/javascript" src="llibreries/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/docs.js"></script>
<script type="text/javascript" src="addons/pager/jquery.tablesorter.pager.js"></script>

    <script type="text/javascript">
        $(function() 
    {
                $("table")
                .tablesorter({widthFixed: true, widgets: ['zebra']})
                .tablesorterPager({container: $("#pager")
    });
    });
    </script></head>
    <body>
    </body>
    </html>

$(document).ready(function() {
  $('.tooltip').tooltipster({
    contentCloning: false
  });
});
<html><head>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.js"></script>
  <link rel="stylesheet" href="css/jq.css" type="text/css" media="print, projection, screen" />
  <link rel="stylesheet" href="themes/blue/style.css" type="text/css" media="print, projection, screen" />
  <link rel="stylesheet" href="css/vista.css" type="text/css" />
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/tooltipster.min.css" />
  <script type="text/javascript" src="llibreries/jquery-latest.js"></script> 
  <script type="text/javascript" src="llibreries/jquery.tablesorter.js"></script>
  <script type="text/javascript" src="js/docs.js"></script>
  <script type="text/javascript" src="addons/pager/jquery.tablesorter.pager.js"></script>
</head>
    <body>
    </body>
</html>


来源:https://stackoverflow.com/questions/43584458/uncaught-typeerror-tooltipster-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!