Bootstrap Datepicker appearing at incorrect location in a modal

前端 未结 7 1655
深忆病人
深忆病人 2020-12-29 20:18

I have a button on a page that calls a modal having datepicker.

If this button is at top (I don\'t have to scroll page to click), modal opens and datepicker displays

7条回答
  •  既然无缘
    2020-12-29 21:14

    I just ran into this same issue. I was able to solve it by adding a container attribute to the div.

    $('#myDatePicker').datepicker({
      container:'#myModalId'
    });
    

    or if you are using the "lazy load" method as I was:

    
    

    Reference : http://bootstrap-datepicker.readthedocs.org/en/latest/options.html

    Hope it helps someone else!

提交回复
热议问题