【发布时间】:2016-03-18 22:38:08
【问题描述】:
我知道已经问过很多类似的问题,但没有一个能解决我的问题。我尝试了很多次,但日期选择器仍然无法正常工作。
所以在我的母版页中
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<head/>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
在我的内容页面中(asp 内容占位符 1 内的头部部分)
// i tried this 4 way but still not work
// $("[id$=txtStart]")
// $("input[id$='date2']").datepicker();
<%--<%=txtStart.ClientID%>--%>
<%-- $("#<%=txtStart.ClientID %>")--%>
$(document).ready(function () {
$('[id$=txtStart]').datepicker({
minDate: 0,
dateFormat: 'dd/mm/yy',
numberOfMonths: 2,
onSelect: function (dateStr) {
var min = $(this).datepicker('getDate'); // Get selected date
min.setDate(min.getDate() + 1);
$('[id$=txtEnd]').datepicker('option', 'minDate', min); // Set other min, default to today
}
});
//another datepicker same as above
$('[id$=txtEnd]').datepicker({
.....
}
});
});
这是我的控制
<td class="auto-style3"><asp:TextBox ID="txtStart" runat="server" > </asp:TextBox>
<td class="auto-style3"><asp:TextBox ID="txtEnd" runat="server" > </asp:TextBox>
【问题讨论】:
-
$("#"+).datepicker({}) 试试这个。
-
你看过jQuery UI page的例子了吗?我测试了它,这正是你所需要的
-
@ParthTrivedi 出现语法错误
-
你能告诉我吗?哪个错误
-
@ParthTrivedi 我已经修复了语法错误,但日期选择器仍然无法正常工作
标签: javascript c# jquery datepicker master-pages