6

I had Bootstrap 3.3.6 and jQuery 1.12.4 working in my website.

As jQuery 3.0.0 was released into production, I upgraded jQuery to jQuery-3.0.0.js. After that, when I ran my site I got this console error.

Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3

Tried adding jQuery Migrate 3.0.0 plugin, but it didn't work too.

The error still persists and Bootstrap's JavaScript won't work. Is there a work around? Or do one have to wait till the next release of bootstrap?

Found this in Bootstrap source.

+function ($) {
  'use strict';
  var version = $.fn.jquery.split(' ')[0].split('.')
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) {
    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')
  }
}(jQuery);

Does this mean that one have to wait for a later version?

naveen
  • 53,448
  • 46
  • 161
  • 251
  • 2
    `Does this mean that one have to wait for a later version?` For the moment, yes. I believe that bootstrap has issues with the 3.0 version of jQuery, hence the block. They are working on this. You could amend the bootstrap source to remove the block, but I would not recommend it at all – Rory McCrossan Jul 14 '16 at 08:18
  • 1
    Here is the corresponding issue on github [Bootstrap v3 is not compatible with jQuery 3.0](https://github.com/twbs/bootstrap/issues/16834) – t.niese Jul 14 '16 at 08:23
  • thanks guys. I see it as a open issue in [v3.3.7 Milestone](https://github.com/twbs/bootstrap/milestone/34) – naveen Jul 14 '16 at 08:26

2 Answers2

10

Bootstrap 3.3.7 now supports jQuery 3+.

  • Does not appear to work with jquery 3.5.1 - it is failing in the `getParent()` function. – user9645 Nov 04 '20 at 19:54
  • 1
    I realise is this an old post, but just in case someone else is wrestling with this issue. I can confirm there are issues with Boostrap 3.3.7 and jQuery 3.6.0. For me, it's throwing an error within the bootstrap.min.js file (JQMIGRATE: jQuery.isFunction() is deprecated). I'll post a workaround if I can come up with one. – Morris Aug 19 '22 at 09:50
2

Adding the following to the top of the bootstrap.min.js file and tweaking the isFunction condition worked for me.

function isFunction(func){
    return typeof func === "function";
}

And then, still in bootstrap.min.js, find:

a.isFunction

and replace with:

isFunction
Morris
  • 218
  • 1
  • 10