Share the post "JQuery UI DatePicker Not Shown In Bootstrap Modal Window"
Well, this one bugged me down for hours. I thought the problem was Bootstrap’s form-control CSS class since removing it shows the Jquery UI DatePicker widget but the input field styling is gone.
User lastoneisbearfood in the StackOverflow forum provided 2 easy solutions of your preference: either adding a css attribute or doing it Javascript style.
on-JS Just add z-index:1051; to the style attribute of your input element. This is based on the observation that bootstrap .modal class uses a z-index of 1050.
Dynamic solution using JS When declaring your datepicker, add a beforeShow handler that retrieves the z-index of .modal and set datepicker’s z-index to 1 higher than that:
|
1 2 3 4 |
datepicker({beforeShow: function(inputElem, inst) { var zi = Number($(inputElem).closest('.modal').css('z-index')); $(inputElem).css('z-index',zi+1); }}); |