Search code examples
javascriptjquerycssdatepickerbootstrap-datepicker

Choose div where to load Bootstrap Datepicker


I have my own dropdown, where I want to load Bootstrap Datepicker and in documentation I cant find anything about that. There's my JSFiddle about examples what I want to make

This is how looks my HTML, where I want to add datepicker

<div class="my-example">
  <input id="" placeholder="press to show calendar" class="input">
  <div class="dropdown">
   there is div, where I need to load my datepicker
  </div>
</div>

Solution

  • Add a div so you can load your picker:

    <div class="dropdown">
        <div class="datetimepickerinline">
            there is div, where I need to load my datepicker
        </div>
    </div>
    

    and then target that new div (this way it wont conflict with the bootstrap dropdown etc):

    $('.datetimepickerinline').datetimepicker({inline: true});
    

    The key to making this work is by setting the inline property to true.