Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: $(…).tooltip is not a function

Tags:

jquery

I am getting

TypeError: $(…).tooltip is not a function

error in the jquery file in which i am initialising tooltip() function while using lightbox2 with bootstrap.

$(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>
like image 781
Gagandeep Avatar asked Jul 21 '16 13:07

Gagandeep


1 Answers

This can happen when jQuery is included twice.

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

//= require jquery

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

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

like image 66
vmarquet Avatar answered Nov 29 '22 13:11

vmarquet