2016-12-13 27 views
0

我想在文本框聚焦时弹出日历控件。除日历控件未显示外,一切正常。如何在Asp.Net中使用jQuery的DatePicker控件

代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head runat="server"> 
     <title></title> 
     <script src="https://code.jquery.com/jquery-latest.js"></script> 
     <script type="text/javascript"> 
      $(document).ready(function() { 
       $('#txt_date').datepicker(); 
      }) 
     </script> 
    </head> 
    <body> 
     <form id="form1" runat="server"> 
      <div> 
       <asp:TextBox ID="txt_date" Class="txt_date" runat="server"></asp:TextBox> 
      </div> 
     </form> 
    </body> 
</html> 
+1

jQuery是不是jQueryUI的......你需要jQueryUI的太:) –

回答

0

您还需要包括JqueryUI

<!doctype html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> 
    <link rel="stylesheet" href="/resources/demos/style.css"> 
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script> 
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 
    <script> <--This is path to jqueryUI 
    $(function() { 
    $("#txt_date").datepicker(); 
    }); 
    </script> 
</head> 
<body> 


<form id="form1" runat="server"> 
<div> 
    <asp:TextBox ID="txt_date" Class="txt_date" runat="server"></asp:TextBox> 
</div> 
</form> 

</body> 
</html> 
相关问题