我正在使用Bootstrap v3,并且想使用Eonasdan的DateTimePicker。我已经在其他项目中使用它,没有任何问题。我现在的问题是,当单击输入框时,DateTimePicker不显示。输入框在那里,日期显示在输入框中。只是没有弹出选取器而已。下面是我的代码:
HTML:
<div class="col-md-10" id="mSearchValueInput">
<input id="mSearchValue" type="text" class="form-control date">
</div>JavaScript:
<script type="text/javascript">
$(function () {
$('#mSearchValue').datetimepicker();
});
</script>这些库的顺序是正确的(我认为),并且它们处于原始状态:
<script src="/Scripts/jquery-3.1.0.js"></script>
<script src="/Scripts/moment.js"></script>
<script src="/Scripts/moment-with-locales.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/bootstrap-datetimepicker.js"></script>CSS:
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/bootstrap-datetimepicker.css" rel="stylesheet"/>
<link href="/Content/site.css" rel="stylesheet"/>尽管如此,我不知道我做错了什么。在我的所有其他项目中,它都是这样工作的。
也许这里有人有个主意?
谢谢
发布于 2016-07-29 14:32:06
正如@VincenzoC在其中一条评论中所描述的那样,目前jQuery v3和DateTimePicker的最新版本(4.17.37)存在问题。
他们使用jquery- suggest -3.0.0.js迁移,我没有尝试过。有一个pull request通过编辑bootstrap-datetimepicer.js中的JavaScript代码为我修复了这个问题。
发布于 2018-03-14 14:33:19
master
<asp:ScriptReference Path="/Scripts/jquery-1.10.2.min.js"/>
<asp:ScriptReference Path="Scripts/jquery-1.10.2.js"/>
<asp:ScriptReference Path="Scripts/jquery-1.10.2.min.map"/>
<asp:ScriptReference Path="/Scripts/bootstrap.min.js" />
<asp:ScriptReference Path="/Scripts/moment-with-locales.js"/>
<asp:ScriptReference Path="Scripts/moment-with-locales.min.js"/>
<asp:ScriptReference Path ="/Scripts/bootstrap-datetimepicker.js"/>
<asp:ScriptReference Path ="Scripts/bootstrap-datetimepicker.min.js"/>
<asp:ScriptReference Path ="Scripts/respond.js"/>
<asp:ScriptReference Path ="Scripts/respond.min.js"/>
<script type="text/javascript">
function pageLoad() {
//Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
//Sys.WebForms.PageRequestManager.getInstance().beginAsyncPostBack();
$(document).ready(function () {
$('#<%=TbInDateTime.ClientID%>').datetimepicker(
{
format: "DD/MM/YYYY hh:mm:ss A"
}
);
});
$(document).ready(function () {
$('#<%=TbOutDateTime.ClientID%>').datetimepicker(
{
format: "DD/MM/YYYY hh:mm:ss A"
}
);
});
} <div style="position:relative; text-align:center;">
<asp:TextBox ID="TbInDateTime" runat="server" Width="200" EnableViewState="false"></asp:TextBox>
</div>https://stackoverflow.com/questions/38640548
复制相似问题