Just append a div with that class to body, then remove it when you're done:

// Show the backdrop
$('<div class="modal-backdrop"></div>').appendTo(document.body);

// Remove it (later)
$(".modal-backdrop").remove();

Live Example:

$("input").click(function() {
  var bd = $('<div class="modal-backdrop"></div>');
  bd.appendTo(document.body);
  setTimeout(function() {
    bd.remove();
  }, 2000);
});
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<p>Click the button to get the backdrop for two seconds.</p>
<input type="button" value="Click Me">

Answer from T.J. Crowder on Stack Overflow
🌐
MDBootstrap
mdbootstrap.com › standard › modal backdrop
Bootstrap Modal Backdrop - free examples & tutorial
Backdrop options for a responsive popup with Bootstrap 5. Prevent close on click outside with static backdrop, remove backdrop, enable interactivity & more. Default modal backdrop is a delicate shadow overlaying the rest of the page design.
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › components › modal
Modal · Bootstrap
Call a modal with id myModal with a single line of JavaScript: ... Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-backdrop="".
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › components › modal
Modal · Bootstrap v5.0
$modal-inner-padding: $spacer; $modal-footer-margin-between: .5rem; $modal-dialog-margin: .5rem; $modal-dialog-margin-y-sm-up: 1.75rem; $modal-title-line-height: $line-height-base; $modal-content-color: null; $modal-content-bg: $white; $modal-content-border-color: rgba($black, .2); $modal-content-border-width: $border-width; $modal-content-border-radius: $border-radius-lg; $modal-content-inner-border-radius: subtract($modal-content-border-radius, $modal-content-border-width); $modal-content-box-shadow-xs: $box-shadow-sm; $modal-content-box-shadow-sm-up: $box-shadow; $modal-backdrop-bg: $black;
🌐
GitHub
github.com › mdbootstrap › bootstrap-modal-backdrop
GitHub - mdbootstrap/bootstrap-modal-backdrop: Backdrop options for a responsive popup with Bootstrap 5. Prevent close on click outside with static backdrop, remove backdrop, enable interactivity & more. · GitHub
Default modal backdrop is a delicate shadow overlaying the rest of the page design. <!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-mdb-toggle="modal" data-mdb-target="#exampleModal"> Launch demo modal </button> ...
Author   mdbootstrap
🌐
Bootstrap
getbootstrap.com › docs › 5.3 › components › modal
Modal · Bootstrap v5.3
The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also overrides default scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal.
🌐
CodePen
codepen.io › artzeeone › pen › yJVJBr
Custom Bootstrap modal backdrops
.modal-backdrop { background-color: transparent; } .modal-backdrop-transparent { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: transparent; opacity: 0; width: 100%; height: 100%; z-index: -1000; } .modal-backdrop-orange ...
Find elsewhere
🌐
W3Schools
w3schools.com › bootstrap › tryit.asp
Modal Options
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
CodePen
codepen.io › cristinaconacel › pen › ZmxgYm
Bootstrap 4 Basic Modal with Static Backdrop
<div class="container"> <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#glassAnimals" data-backdrop="static"> Glass Animals Info </button> </div> <div class="modal fade" id="glassAnimals" tabindex="-1" role="dialog" ...
🌐
Codeply
codeply.com › go › oNKsVikW6n
Bootstrap 4 modal backdrop color on Codeply
HTML, CSS, JavaScript editor playground for designers & developers to compare, prototype and test frontend frameworks
🌐
GeeksforGeeks
geeksforgeeks.org › bootstrap-5-modal-static-backdrop
Bootstrap 5 Modal Static backdrop | GeeksforGeeks
November 30, 2022 - Example 1: This example describes the basic usage of the Modal Static backdrop in Bootstrap 5, where we will create a static modal and use an image in the body.
🌐
MDBootstrap
mdbootstrap.com › standard › modal
Bootstrap Modal - free examples & tutorial
Responsive popup window with Bootstrap 5. Examples of with image, modal position i.e. center, z-index usage, modal fade animation, backdrop usage, modal size & more.
🌐
Bootstrap
getbootstrap.com › docs › 4.6 › components › modal
Modal · Bootstrap v4.6
Call a modal with id myModal with a single line of JavaScript: ... Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-backdrop="".
🌐
W3Schools
w3schools.com › bootstrap › bootstrap_ref_js_modal.asp
Bootstrap JS Modal Reference
For data attributes, append the option name to data-, as in data-backdrop="". The following table lists all available modal methods. The following table lists all available modal events. ... <div class="container"> <h2>Modal Login Example</h2> <!-- Trigger the modal with a button --> <button type="button" class="btn btn-default btn-lg" id="myBtn">Login</button> <!-- Modal --> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;<
🌐
CoreUI
coreui.io › react › documentation › components › modal
Bootstrap Modal - extended examples and tutorials
July 5, 2023 - For example, data-bs-toggle="..." ... scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal....
🌐
Bbbootstrap
bbbootstrap.com › home › snippets › bootstrap 5 static backdrop modal
Bootstrap 5 Static backdrop modal Example
Bootstrap 5 Static backdrop modal snippet is created by BBBootstrap Team using Bootstrap 5. This snippet is free and open source hence you can use it in your project.Bootstrap 5 Static backdrop modal snippet example is best for all kind of projects.A great starter for your new awesome project with 1000+ Font Awesome Icons, 4000+ Material Design Icons and Material Design Colors at BBBootstrap.com.
🌐
Rick Strahl's Web Log
weblog.west-wind.com › posts › 2016 › sep › 14 › bootstrap-modal-dialog-showing-under-modal-background
Bootstrap Modal Dialog showing under Modal Background - Rick Strahl's Web Log
September 14, 2016 - Just make sure you use !important and you ensure that the .modal-content is set higher than .modal-backdrop. One workaround is to essentially force the modal out to the body tag with script. Since I trigger the modal in code anyway, it's easy enough to do the following: