javascript - 在模态中初始化后日期选择器不显示
问题描述
我有 Javascript 在模式中显示它后 incialize datepicker。当我调试它时,一切看起来都很好,即使我在控制台中触发了初始化,但 datepicker 仍然没有显示出来。
这是我的 JS 代码:
$('<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">' + '<div id="modal-container" class="modal-dialog .modal-dialog-centered" style="height:80% !important;max-width:80%;!important">' +
'<div class="modal-content" id= "modalbody" >' +
data + '</div></div></div>').modal();
$('input[data-datepicker]').datepicker({
format: 'dd.mm.yyyy',
days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek'],
daysShort: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'],
daysMin: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'],
months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
monthsShort: ['Led', 'Úno', 'Bře', 'Dub', 'Kvě', 'Čer', 'Čec', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'],
autoHide: true
});
在 data 属性中是模态体,其中包含以下输入:
<input title="@i.Value" style="padding-right:30px; width:100%" autocomplete="off" type="text" data-datepicker required class="disabled" name="@i.Id" id="@i.Id" value="@i.Value" onfocusout="return SaveEdit('@i.Id');" />
有谁知道这是什么原因?
解决方案
推荐阅读
- javascript - 如何在需要('./
') 抛出错误:找不到模块'./ '? - laravel - 在 Laravel 5.8 上运行 db 种子时数组到字符串的转换异常?
- android - Android:onDisable 无法始终如一地工作
- delphi - 在你离开的地方继续'for'
- angular - FormControl init 方法有什么区别?
- java - Execute a .jar file using shell script
- c# - 不在管理员模式下时,在 TLS 1.2 连接期间无法创建 SSL/TLS 安全通道错误
- reactjs - How to use React Router's Link with a variable pathname?
- python - how to resolve this error InvalidArgumentError: sequential_6_input:0 is both fed and fetched
- php - How to update multiple MySQL table entries with different id?