While working with a bootstrap modal, I noticed that the background content opacity does not change by default when the modal is open. I attempted to change this using JavaScript:
function showModal() {
document.getElementById("pageContent").style.opacity = "0.5";
}
However, I encountered an issue where the opacity style would still remain on the pageContent even after the modal was closed. I am aware that this is not the correct approach. Any assistance would be greatly appreciated. Thank you.
The HTML button that triggers the modal is:
<button class="btn glossy-clear" data-toggle="modal" data-target="#modal-display" onclick="showModal()">Clear</button>
Here is the modal code:
<div class="modal fade" id="modal-display">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body">
<div class="container">
<div class="row">
<div class="col-md-5">Hello</div>
<div class="col-md-5">i!!!!</div>
</div>
</div>
</div>
</div>
</div>
</div>
EDIT: