如何使用eternicode bootstrap 日期选择器
How to use eternicode bootstrap datepicker
我什至无法让基本的日历弹出窗口出现。这是我的脚本和代码:
Note: I am using jquery 1.10.2 and it is included first.
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/bootstrap-datepicker.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-datepicker3.css",
"~/Content/site.css",
"~/Content/override.css"));
<div class="input-group date">
@Html.TextBox("ForesterDate", today, new { @class = "form-control datepicker" })
<span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
并在页面底部的脚本标记中:
$(document).ready(function () {
$('.datepicker').datepicker();
});
文本框的样式看起来是正确的,但点击没有效果。我想这可能是剃刀问题,所以我用 html 创建了一个文本框,没有变化:
<input type="text" class="form-control datepicker" />
问题原来是我的脚本标签在哪里。这是我的第一个 MVC5 应用程序,我想你不能再将它固定在视图的底部,它必须位于 @section() 中,它在 _include.
底部呈现
我什至无法让基本的日历弹出窗口出现。这是我的脚本和代码:
Note: I am using jquery 1.10.2 and it is included first.
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/bootstrap-datepicker.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-datepicker3.css",
"~/Content/site.css",
"~/Content/override.css"));
<div class="input-group date">
@Html.TextBox("ForesterDate", today, new { @class = "form-control datepicker" })
<span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
并在页面底部的脚本标记中:
$(document).ready(function () {
$('.datepicker').datepicker();
});
文本框的样式看起来是正确的,但点击没有效果。我想这可能是剃刀问题,所以我用 html 创建了一个文本框,没有变化:
<input type="text" class="form-control datepicker" />
问题原来是我的脚本标签在哪里。这是我的第一个 MVC5 应用程序,我想你不能再将它固定在视图的底部,它必须位于 @section() 中,它在 _include.
底部呈现