Bootstrap Datepicker in Modal Popup Window

jQuery Datepicker in Bootstrap Modal
Code Snippet:
Published: March 1, 2024
Last Updated: March 4, 2024
Downloads: 22,162
License: MIT
Edit Code online: CodeHim
Read More

Yet another datepicker jQuery plugin easily used in Bootstrap modal popup. The plugin has multi options, multi functions and multi languages to pick current, selected or filtered date.

Plugin Overview

Plugin: datepicker-in-bootstrap-modal
Author: Fengyuan Chen
Licence: MIT Licence
Published: March 1, 2024
Repository: Fork on GitHub
Dependencies: jQuery 3.3.1 or Latest version, Bootstrap 4.1.3
File Type: zip archive (HTML, CSS & JavaScript)
Package Size: 38 KB

How to Use Datepicker in Bootstrap Modal:

1. To getting started with this plugin, load the jQuery and Bootstrap framework.

<!-- jQuery -->
<script src=""></script>

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="">

<!-- Bootstrap Js -->
<script src=""></script>

2. After this, include the datepicker’s javascript and CSS files.

<!-- Datepicker CSS -->
<link rel="stylesheet" href="css/datepicker.css">

<!-- Datepicker JS-->
<script src="js/datepicker.js"></script>

3. To create Bootstrap datepicker in modal popup, so build the HTML structure like below.

 <!-- Button trigger modal -->
    <button type="button" class="btn btn-primary" data-target="#modal" data-toggle="modal">
      Launch the demo

    <!-- Modal -->
    <div class="modal fade" id="modal" role="dialog" aria-labelledby="modalLabel" tabindex="-1">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="modalLabel">Datepicker</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">×</span>
          <div class="modal-body" style="height: 1000px;">
            <input type="text" class="form-control" data-toggle="datepicker">
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

4. Initialize the plugin in jQuery document ready function so that datepicker activated.

 $(function() {
      autoHide: true,
      zIndex: 2048,

4 thoughts on “Bootstrap Datepicker in Modal Popup Window”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link