75

Does Twitter Bootstrap v3 include jQuery or do I need to include jQuery separately? If it does include jQuery, what version (number) of jQuery is included, and are all jQuery functions available when using Bootstrap?

Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404
Matt K
  • 7,207
  • 5
  • 39
  • 60
  • 7
    I don't see a version number for jQuery on their website.. Also it says "With Bootstrap, you get custom-built jQuery plugins to bring your projects to life." That doesn't answer my question. – Matt K Jul 17 '12 at 16:16
  • 4
    "Heads up! All javascript plugins require the latest version of jQuery." – Mike Robinson Jul 17 '12 at 16:16
  • 1
    What do you mean by "are all jQuery functions available"? – Esailija Jul 17 '12 at 16:17
  • 1
    I've updated my question to be more specific. I was curious about whether or not I needed to include jQuery separately when using Bootstrap. – Matt K Jul 17 '12 at 16:24
  • 1
    @MatthewKeefe updated my answer ... no its not included - its a set of plugins .. just like any other plugin you find on the web ... – Manse Jul 17 '12 at 16:26
  • 1
    @ManseUK Thanks! It wasn't clear to me from their documentation, but it makes sense now. – Matt K Jul 17 '12 at 16:28
  • 1
    The Bootstrap 2.3 release announcement says "Upgraded to jQuery 1.9. No changes were needed, but we did upgrade the included jQuery file to the latest release.", but this is misleading. jQuery is not included in the bootstrap.js file. – Jeromy French Feb 26 '13 at 16:10

3 Answers3

55

Heads up! All javascript plugins require the latest version of jQuery.

Right here in the docs

Here is the current release link for jQuery

There are a number of elements to the Bootstrap "product" - one of them are JavaScript Plugins - only these require jQuery - and they extend the jQuery functionality so yes all jQuery methods / functions are available. The remainder (CSS, Scaffolding, Components etc) require HTML and CSS (or a combination)

jQuery is not included within the Twitter Bootstrap download - you must download it / link to a CDN version of it

EDIT:

2.X requires atleast 1.7
aWebDeveloper
  • 36,687
  • 39
  • 170
  • 242
Manse
  • 37,765
  • 10
  • 83
  • 108
  • 4
    This answer is for Bootstrap 2, which hasn't been supported for a while. [Bootstrap 3 also requires all jQuery plugins.](http://getbootstrap.com/customize/). However, the question is, does Bootstrap include jQuery? And the answer is yes - one can look in [bootstrap.min.js](wget https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js), which starts with `if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery")`. – Dan Dascalescu Jul 17 '15 at 08:08
  • 3
    I think the comment by @DanDascalescu is wrong. The answer is still no, it's not included, right!? If you look at the code, bootstrap throws an error if jQuery is not found, but it does not include it. – Martijn Burger Nov 28 '15 at 09:55
  • The [link above](http://getbootstrap.com/javascript/) to Bootstrap's docs actually says "[Consult our bower.json](https://github.com/twbs/bootstrap/blob/v3.3.7/bower.json) to see which versions of jQuery are supported." At this moment, the bower.json says "jquery": "1.9.1 - 3" That's quite a wide range of jQuery that's supported. So, it doesn't seem accurate to say "All javascript plugins require the latest version of jQuery." – Oran Dennison Jun 09 '17 at 00:45
  • the first link does not work anymore. [The docs](https://getbootstrap.com/docs/5.0/getting-started/javascript/#still-want-to-use-jquery-its-possible) can be misunderstood here, I think that pure bootstrap 5 works without `jquery`, but the plugins/components? like `bootstrap-select` still need it. – Timo Sep 09 '22 at 08:59
30

Does Twitter Bootstrap use jQuery?

Yes, jQuery plugins require jQuery. And as Mike pointed out, it is clearly mentioned on the site.

If so, what version (number) of jQuery is used

Also as Mike mentioned, latest version

are all jQuery functions available?

jQuery functions are available through jQuery, they have nothing to do with Bootstrap. If you include the jQuery library, you can use any jQuery functionality you want.

Terry
  • 14,099
  • 9
  • 56
  • 84
6

The Bootstrap jQuery plugins are just like any other jQuery plugins in that they require jQuery to work. You download jQuery and include it in your page, and then include the Boostrap plugins.

It doesn't use a specific version of jQuery, just get the latest version from the jQuery site.

All jQuery functions are available in jQuery (how else?), Bootstrap has nothing to do with it... it just gives you some extra plugins.

sachleen
  • 30,730
  • 8
  • 78
  • 73