jQuery日期选择器显示空白文本框

时间:2014-05-04 12:29:00

标签: jquery asp.net

我试图使用jquery datepicker。虽然我是jQuery的新手,但我看过类似的实现,但我仍然显示空文本框。

我做错了什么?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testing.aspx.cs" Inherits="healthcare.testing" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-ui-1.10.4.custom.min.js"></script>
<script src="Scripts/jquery-ui-1.10.4.custom.js"></script>
<link href="Scripts/jquery-ui-1.10.4.custom.min.css" rel="stylesheet"  />
<script>

    $(function ()
    {

        $("#<%=txtdisplaydate.ClientID%>").datepicker();
});
</script>
</head>
 <body>
 <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtdisplaydate" runat="server" />
    </div>
   </form>
 </body>
 </html>

1 个答案:

答案 0 :(得分:1)

尝试以下代码:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testing.aspx.cs" Inherits="healthcare.testing" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <script>

        $(function ()
        {

            $("#<%=txtdisplaydate.ClientID%>").datepicker();
    });
    </script>
    </head>
     <body>
     <form id="form1" runat="server">
        <div>
            <asp:TextBox ID="txtdisplaydate" runat="server" />
        </div>
       </form>
     </body>
     </html>