TypeError: $ (...). Tooltip is not a function

I get

TypeError: $ (...). Tooltip is not a function

in the jquery file in which I initialize the tooltip () function when using lightbox2 with loading.

$(function() {
  $('[data-toggle="tooltip"]').tooltip({
      html: true
  });
});
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
        <script src="bootstrap/js/bootstrap.js"></script>
        <script src="main.js"></script>
</head>
<body>
  <script src="lightbox-plus-jquery.min.js"></script>
</body>
Run codeHide result
+4
source share
1 answer

This can happen when jQuery is turned on twice.

For users using Rails, jQuery is already enabled by default (check app/assets/javascripts/application.js):

//= require jquery

Enabling jQuery again, for example with a tag <script>in app/views/layouts/application.html.erb, will result in this error.

The solution is to remove the tag <script>in app/views/layouts/application.html.erb.

+5
source

Source: https://habr.com/ru/post/1648653/


All Articles