bootstrap datetimepicker 不工作,不显示 javascript 错误
bootstrap datetimepicker not working, displays no javascript errors
我按照建议用 NuGet 安装了 Bootstrap Datetimepicker here 下面是无法显示 datetimepicker 控件的 html 代码。在 chrome 开发人员工具中,我发现脚本加载没有问题,控制台中也没有任何脚本错误。猜猜为什么下面的代码无法显示 bootstrap datetimepicker
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="/scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="/scripts/moment.min.js"></script>
<script type="text/javascript" src="/scripts/bootstrap-datetimepicker.js"></script>
<link rel="stylesheet" href="/Content/bootstrap-datetimepicker.css" />
<!-- include your less or built css files -->
<!--
bootstrap-datetimepicker-build.less will pull in "../bootstrap/variables.less" and "bootstrap-datetimepicker.less";
or-->
</head>
<body>
<form>
<div class="container">
<div class="row">
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datetimepicker();
});
</script>
</div>
</div>
</form>
</body>
</html>
您的代码有效。你错过的是bootstrapCSS。在您单击以显示它的输入旁边应该有一个日历图标。但是日历也没有样式。
试着把这个放在你的头上:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
我按照建议用 NuGet 安装了 Bootstrap Datetimepicker here 下面是无法显示 datetimepicker 控件的 html 代码。在 chrome 开发人员工具中,我发现脚本加载没有问题,控制台中也没有任何脚本错误。猜猜为什么下面的代码无法显示 bootstrap datetimepicker
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="/scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="/scripts/moment.min.js"></script>
<script type="text/javascript" src="/scripts/bootstrap-datetimepicker.js"></script>
<link rel="stylesheet" href="/Content/bootstrap-datetimepicker.css" />
<!-- include your less or built css files -->
<!--
bootstrap-datetimepicker-build.less will pull in "../bootstrap/variables.less" and "bootstrap-datetimepicker.less";
or-->
</head>
<body>
<form>
<div class="container">
<div class="row">
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datetimepicker();
});
</script>
</div>
</div>
</form>
</body>
</html>
您的代码有效。你错过的是bootstrapCSS。在您单击以显示它的输入旁边应该有一个日历图标。但是日历也没有样式。
试着把这个放在你的头上:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">