jquery date picker is not working while adding in master pages content place holder. getting error - TypeError: $(...).datepicker is not a function
<asp:Content ID="Content1" ContentPlaceHolderID="Head" Runat="Server">
<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>
<link rel="stylesheet" href="/resources/demos/style.css">
<script type="text/javascript">
$(function () {
$("input[id$=txtDatepicker]").datepicker({
changeMonth: true,
changeYear: true
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID="txtDatepicker" runat="server"></asp:TextBox>
</asp:Content>
最佳答案
使用#txtDatepicker
代替input[id$=txtDatepicker]
$(function () {
$("#txtDatepicker").datepicker({
changeMonth: true,
changeYear: true
});
});
关于javascript - jquery 日期选择器不适用于 ASP.NET 中的母版页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34224224/