Search code examples
jquerytwitter-bootstrapobsolete

Is there a way to use bootstrap with jquery 3.x


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?


Solution

  • Bootstrap 3.3.7 now supports jQuery 3+.