{"record":{"id":"7fd8508a673e7237","repo":"dotnet/AspNetCore.Docs","slug":"bootstrap-s-javascript-requires-jquery-version-1-9","errorCode":null,"errorMessage":"Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4","messagePattern":"Bootstrap's JavaScript requires jQuery version 1\\.9\\.1 or higher, but lower than version 4","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"aspnetcore/mvc/controllers/testing/samples/3.x/TestingControllersSample/src/TestingControllersSample/wwwroot/js/bootstrap.js","lineNumber":15,"sourceCode":"/*!\n * Bootstrap v3.3.7 (http://getbootstrap.com)\n * Copyright 2011-2016 Twitter, Inc.\n * Licensed under the MIT license\n */\n\nif (typeof jQuery === 'undefined') {\n    throw new Error('Bootstrap\\'s JavaScript requires jQuery')\n  }\n  \n  +function ($) {\n    'use strict';\n    var version = $.fn.jquery.split(' ')[0].split('.')\n    if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {\n      throw new Error('Bootstrap\\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')\n    }\n  }(jQuery);\n  \n  /* ========================================================================\n   * Bootstrap: transition.js v3.3.7\n   * http://getbootstrap.com/javascript/#transitions\n   * ========================================================================\n   * Copyright 2011-2016 Twitter, Inc.\n   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n   * ======================================================================== */\n  \n  \n  +function ($) {\n    'use strict';\n  \n    // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)\n    // ============================================================\n  ","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/dotnet/AspNetCore.Docs/blob/c67a80103a1a74db20784debd919c7fdda96c510/aspnetcore/mvc/controllers/testing/samples/3.x/TestingControllersSample/src/TestingControllersSample/wwwroot/js/bootstrap.js#L1-L33","documentation":"Immediately after the jQuery-present check, Bootstrap 3.3.7 parses $.fn.jquery and asserts the version is >= 1.9.1 and < 4. Bootstrap 3 was written against jQuery 1.9–2.x/3.x APIs; jQuery 1.8 lacks APIs it needs and jQuery 4 removed others. Out-of-range versions throw on load.","triggerScenarios":"Loading jQuery 1.8 or earlier; loading jQuery 4.x alongside Bootstrap 3.3.7; bundling upgrading jQuery without upgrading Bootstrap.","commonSituations":"Upgrading jQuery to 4 in a legacy app still on Bootstrap 3; very old jQuery shipped with a template; mixed CDN versions across pages.","solutions":["Use a jQuery version in the supported range (1.9.1 up to and including 3.x).","If you must use jQuery 4, upgrade Bootstrap to v5+ which supports it.","Pin the jQuery version explicitly in your bundle/CDN rather than @latest."],"exampleFix":"// before\n<script src=\"https://code.jquery.com/jquery-4.0.0.min.js\"></script>\n<script src=\"bootstrap.js\"></script> <!-- throws -->\n// after\n<script src=\"https://code.jquery.com/jquery-3.7.1.min.js\"></script>\n<script src=\"bootstrap.js\"></script>","handlingStrategy":"validation","validationCode":"// Verify jQuery version range before assuming Bootstrap 3 will load.\nfunction jqueryVersionOk() {\n  if (typeof jQuery === 'undefined') return false;\n  var v = jQuery.fn.jquery.split('.').map(Number);\n  return !(v[0] < 1 || (v[0] === 1 && v[1] < 9) || (v[0] === 1 && v[1] === 9 && v[2] < 1) || v[0] > 3);\n}\nif (!jqueryVersionOk()) {\n  console.error('jQuery version out of Bootstrap 3 range [1.9.1, 4)');\n}","typeGuard":"function isSupportedJQueryForBootstrap3() {\n  if (typeof jQuery === 'undefined') return false;\n  var v = jQuery.fn.jquery.split('.').map(Number);\n  return v[0] >= 1 && !(v[0] >= 4) && !(v[0] === 1 && v[1] < 9);\n}","tryCatchPattern":"window.addEventListener('error', function (ev) {\n  if (ev && /requires jQuery version/.test(ev.message || '')) {\n    console.error('Pin jQuery to 1.9.1–3.x for Bootstrap 3, or upgrade Bootstrap to v5 for jQuery 4');\n  }\n}, true);","preventionTips":["Pin jQuery to a specific 3.x version; never use @latest with Bootstrap 3.","If moving to jQuery 4, upgrade Bootstrap to v5 at the same time.","Add a smoke test that loads the page and asserts no Bootstrap version error fires."],"tags":["bootstrap","jquery","version-compatibility","dependency"],"backgroundTag":null,"analyzedSha":"c67a80103a1a74db20784debd919c7fdda96c510","analyzedAt":"2026-08-13T17:46:11.763Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}