This should definitely work. I made a fiddle with jquery ui datepicker in a modal window. check this out: https://jsfiddle.net/kr20nu8n/2/
HTML:
<button id="openModalButton">open modal</button> <div id="myModal" class="modal"> <div class="modal-dialog"> <div class="modal-content"> <input placeholder="click for datepicker" type="text" id="datepicker"> </div> </div> </div>
JS:
$("#datepicker").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", }); $("#openModalButton").click(function () { $('#myModal').modal(); });
Perhaps if you could post your full code, we might find an error that causes this.
source share