ref:
http://www.w3cschool.cc/bootstrap/bootstrap-v2-modal-plugin.html
http://getbootstrap.com/javascript/
example code:
<html>
<head>
<title> Date time picker </title>
<link href="bootstrap-3.3.4-dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="jquery-2.1.3.min.js"></script>
<script src="bootstrap-3.3.4-dist/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Large modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>
<div class="modal fade bs-example-modal-lg" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
Large Modal
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
modal footer
</div>
</div>
</div>
</div>
<!-- Small modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
...
</div>
</div>
</div>
<script>
var modal = $('#bs-example-modal-lg');
console.log(modal);
modal.on('show.bs.modal', function(){console.log("show");});
modal.on('shown.bs.modal', function(){console.log("shown");});
</script>
</body>
</html>
following is the method to add event listener.
Just wanted to say that Bootstrap 3 handles this a bit differently. The event name is "shown.bs.modal".
$('#themodal').on('shown.bs.modal', function () {
$("#txtname").focus();
});
or put the focus on the first visible input like this:
.modal('show').on('shown.bs.modal', function ()
{
$('input:visible:first').focus();
})