open modal event bootstrap
To open a modal event in Bootstrap, you can use the following code:
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
Open Modal
</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Modal Title</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Modal content goes here.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
This code includes a button that triggers the modal when clicked. The modal itself is defined within a <div>
element with the class "modal fade" and a unique ID. The button's data-target
attribute is set to the ID of the modal, and the data-toggle
attribute is set to "modal". The modal content is placed within the <div class="modal-content">
element, including the header, body, and footer sections.
Please note that you may need to include the necessary Bootstrap CSS and JavaScript files for the modal to work properly.