Inside Bootstrap Modal Show datepicker in corrrect way

Total Blog Views: 48

Blog Status: publish

Created By: swazahmad Created at: 09-04-2021

Tags: datepicker with boostrap modal datepicker with bootstrap datepicker

Below is The Working Demo for Datepicker with Bootstrap modal

Add Below Script to add Date picker in Script Tag

 

$( function() {
  $( "#datepicker" ).datepicker();
});
$("[id=add]").click(function() {
  $("#myModal .modal-header h4").html("Request for Change");
  $("#myModal").modal("show");
});
$(".date-picker").datepicker({
  orientation: "top",
  beforeShow: function(input, obj) {
$(input).after($(input).datepicker('widget'));
  }
});
$(".date-picker").focus(function (){
  $("#ui-datepicker-div").position({
    my: "center top",
    at: "center bottom",
    of: $(this)
  });
});
.datepicker-container{
  position: relative !important;
}

Add Below Line In Header

 

<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Add Below Line In Body:

 

<div class="well">
  <button type="button" id="add">Add</button>
</div>
<div id="myModal" class="modal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4></h4>
      </div>
      <div class="modal-body">
        <label class="label">Date picker</label>
        <div class="datepicker-container">
          <input class="form-control datePicker date-picker" id="datepicker" placeholder: "MM/YYYY">
        </div>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
        <h1>helllo</h1>
      </div>
    </div>
  </div>
</div>


swazahmad

Swaz is Practice Lead of ROR Developer. he's a Blogger, Mentor, and Rubyst. He has expertise in Javascript also . he's highly skilled in designing, developing and testing web applications. He enjoys being challenged and interesting with projects that need him to



Comments



  • swazahmad | almost 4 years ago
    If need some more information and sample please do let me know😆😆😆😆🤣
Buy traffic for your website

About Shadbox

we have the “Get things executed” lifestyle at our place of work. There are not any excuses, no if’s or however’s in our dictionary. committed to navigating the ship of creativity to create cell answers, we resolve the real-lifestyles troubles of our clients and their clients. Our passion for work has won us many awards, year after 12 months.

Services

Downloads