尝试将jquery时间选择器插件附加到asp.net项目中的文本框中。 但是当在firefox中运行时出现错误“TypeError:$(...)。timepicker不是函数”。
以及site.master中使用的以下文件
<head runat="server">
<%--<script src="Scripts/jquery-1.7.1.js" type="text/javascript"></script>--%>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="Scripts/jquery-ui-1.8.20.js" type="text/javascript"></script>
<script src="Scripts/bootstrap-datepicker.js"></script> <%--v2.0--%>
<link href="Scripts/bootstrap-datepicker.css" rel="stylesheet" /> <%--v2.0--%>
<script src="Scripts/jquery.timepicker.js"></script> <%--v1.9.0--%>
<link href="Scripts/jquery.timepicker.css" rel="stylesheet" /> <%--v1.9.0--%>
<link href="Content/Site.css" rel="stylesheet" />
<meta charset="utf-8" />
<title><%: Page.Title %> - My ASP.NET Application</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:BundleReference runat="server" Path="~/Content/css" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
<asp:ContentPlaceHolder runat="server" ID="HeadContent" />
我正在默认内容页面中使用时间选择器,如下所示。
<script>
$(function () {
$('#FromtimeTextBox1').timepicker();
$('#TotimeTextBox1').timepicker();
});
我在这里做错了,如何解决这个问题......
感谢。
答案 0 :(得分:0)
好了看下面的代码,我已经在我的本地系统和它的工作中尝试过,只需要处理文件的查询 - 尝试按照下面的步骤编写序列文件。试试jsfiddle:http://jsfiddle.net/e5jzdqug/
<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/ui-lightness/jquery-ui.min.css">
<link rel="stylesheet" href="http://www.jqueryscript.net/demo/Customizable-jQuery-Timepicker-Plugin-timepicker/jquery.timepicker.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/css/bootstrap-datepicker.css">
<script type="text/javascript" src="http://timepicker.co/resources/jquery-timepicker/jquery.timepicker.min.js"></script>
<link rel="stylesheet" href="http://timepicker.co/resources/jquery-timepicker/jquery.timepicker.min.css">
<script type="text/javascript">
$(document).ready(function(){
$('#FromtimeTextBox1').timepicker();
$('#TotimeTextBox1').timepicker();
});
</script>
</head>
<body>
<input id="FromtimeTextBox1" type="text">
<input id="TotimeTextBox1" type="text">
</body>
</html>
答案 1 :(得分:0)
首先检查&#34; Scripts / jquery.timepicker.js&#34;。
第二次按f12并右键单击chrome refresh按钮,然后清除缓存。
第三步检查这个例子。
codepen.io/airsakarya/pen/rerKRV