gpt4 book ai didi

javascript - jquery 日期选择器不适用于 ASP.NET 中的母版页

转载 作者:行者123 更新时间:2023-11-28 18:52:41 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com