提前感谢。
我已经搜索并实施了
$(document).ready(function () {
$("#ui-datepicker").datepicker();
});
和
$(function () {
if (!Modernizr.inputtypes.date) {
$('input[type=date]').datepicker({
dateFormat: 'dd-mm-yyyy'
}
);
}
});
但无法解决问题。所以,请查看下面的代码并告诉我问题是什么
<html class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths" style="">
<head>
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<link href="/Content/bootstrap.min.css" rel="stylesheet">
<link href="/Content/font-awesome.min.css" rel="stylesheet">
<link href="/Content/animate.css" rel="stylesheet">
<link href="/Content/style.css" rel="stylesheet">
<script src="/Scripts/modernizr-2.8.3.js"></script>
<!-- Tweaks for older IEs-->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="section-modal modal fade in" id="new-product-modal" tabindex="-1" role="dialog" aria-hidden="true" style="display: block;overflow-y:scroll;">
<div class="modal-content">
<div class="close-modal" data-dismiss="modal">
<a href="/">
<div class="lr">
<div class="rl">
</div>
</div>
</a>
</div>
<div class="container">
<div class="row">
<div class="section-title text-center">
<h3>Products</h3>
<p>Add a new product into List</p>
</div>
</div>
<form returnurl="" action="/Home/Products" enctype="multipart/form-data" method="post">
<input name="__RequestVerificationToken" value="Cni4uRd3UIZMvQsCWzpt3GQRxRmybm2yKX2xsOHkvS2D_f4qezvaBU38Mg6HYOJZwwe7bIYpjvWSgYOzdA2LxN3MBxG8uGvvB4-xN4W1LK41" type="hidden"> <div class="row form-group warning-message-container">
<div class=" danger" style="color:red;background-color:lightpink;border-radius:0.3em;text-align:center;"></div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group text-right">
<label class="form-label" for="ProductName">Product Name</label> <span style="color:red;">*</span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input class="form-control" data-val="true" data-val-required="The ProductName field is required." id="name" name="ProductName" placeholder="Your Product Name *" value="" type="text">
<span class="field-validation-valid" data-valmsg-for="ProductName" data-valmsg-replace="true"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group text-right">
<label class="form-label" for="Stock">Stock</label> <span style="color:red;">*</span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<div class="col-sm-6">
<div class="row form-group">
<input class="form-control" data-val="true" data-val-number="The field Stock must be a number." data-val-required="The Stock field is required." id="name" name="Stock" placeholder="Your Stock *" value="0" type="text">
<span class="field-validation-valid" data-valmsg-for="Stock" data-valmsg-replace="true"></span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" data-val="true" data-val-number="The field Stock Unit must be a number." data-val-required="The Stock Unit field is required." id="StockUnit" name="SelectedStockUnit" placeholder="Select Unit *">
<option selected="selected" value="0">Select a Unit</option>
<option value="1">Kilogram</option>
<option value="2">Grams</option>
<option value="3">Ton</option>
<option value="4">Liter</option>
<option value="5">Dozen</option>
<option value="6">Quintel</option>
<option value="7">Milli Gram</option>
<option value="8">Peices</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group text-right">
<label class="form-label" for="StockDate">Stock available on Date</label> <span style="color:red;">*</span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input class="text-box single-line" data-val="true" data-val-date="The field Stock on Date must be a date." data-val-required="The Stock on Date field is required." id="StockDate" name="StockDate" value="01/01/0001" type="date">
<span class="field-validation-valid" data-valmsg-for="StockDate" data-valmsg-replace="true"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group text-right">
<label class="form-label" for="ProductDesc">Product Description</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<textarea class="form-control" cols="20" id="ProductDesc" name="ProductDesc" placeholder="Product Description" rows="2" type="text"></textarea>
<span class="field-validation-valid" data-valmsg-for="ProductDesc" data-valmsg-replace="true"></span>
</div>
</div>
</div>
<div class="row">
<div class="clearfix"></div>
<div class="col-lg-12 text-center">
<div id="success"></div>
<button type="submit" class="btn btn-primary" value="Save">Save</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="/Scripts/jquery-ui-1.12.1.js"></script>
<script src="/Scripts/jquery-3.1.1.js"></script>
<script src="/Scripts/jquery.appear.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/Custom/DatePickerReady.js"></script>
<script src="/Scripts/respond.matchmedia.addListener.js"></script>
<script src="/Scripts/respond.js"></script>
<script src="/Scripts/Custom/dropdownlist.js"></script>
<script src="/Scripts/script.js"></script>
</body>
</html>
日期时间选择器无法在Mozilla Firefox上运行。
答案 0 :(得分:7)
$(...)。datepicker不是函数
您的脚本顺序错误,
Jquery Library文件应始终位于顶部,然后是jquery-ui。 保持
Modernizr的-2.8.3.js
之后
jquery-3.1.1.js和 的jquery-UI-1.12.1.js
答案 1 :(得分:0)
导入脚本文件的位置不正确。导入时尝试更改脚本文件的顺序。