In this article, I will show you JQuery bootstrap popup on button click with example. Initially popup was in hidden, when user clicks the show model popup, the jQuery event opens the bootstrap popup model.
HTML code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery-bootstrap modal popup on button click</title>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript">
$(function () {
$("#btnShow").click(function () {
$('#demoModal').modal('show');
});
});
</script>
</head>
<body>
<!--Buttonto Trigger Modal-->
<div style="text-align: center; margin-top: 10%">
<button id="btnShow" class="btn btn-primary btn-lg">Show Modal Popup</button>
</div>
<!--Modal -->
<div class="modal fade" id="demoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Bootstrap Modal Popup</h4>
</div>
<div class="modal-body">content goes here..</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btnbtn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</body>
</html>
Description:
The model popup contains title, body and footer section. You can give a title for the popup and also design form in the body section. The model close and save button is at the bottom of the bootstrap model popup.
Bootstrap model popup Demo:
Post your comments / questions
Recent Article
- ImportError: cannot import name 'url' from 'django.conf.urls' - Django Error
- How to Enable Virtualization in BIOS Security Settings in Intel Processors For Android Studio?
- Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it.
- AttributeError: 'NoneType' object has no attribute 'get_text' - Python
- ModuleNotFoundError: No module named 'openpyxl' - Python
- How to get thumbnail from vimeo video URL in Python?
- Remove all special characters, punctuation except spaces from string - Python
- OSError: cannot write mode RGBA as JPEG- Python
Related Article