为什么JQuery datePicker不执行?

时间:2015-10-31 16:45:08

标签: jquery html css

<!DOCTYPE html>
<html>
    <head>
        <meta charset = "utf-8/">
        <title>Calander</title>
       <script type = "text/javascript" src = "http://code.jquery.com/jquery-1.11.3.min.js"></script>  

<script>
    $('#Date').datepicker();
</script>

    </head>
    <body>

        <label for= "Date"> Date </label>
        <input type = "text" id = "Date" name = "Date"/>
    </body>
</html>

当我运行时,没有任何反应我希望在点击文本框时显示日历。我想这可能是因为格式,即inncorrect src

2 个答案:

答案 0 :(得分:0)

datepicker不是jquery的一部分,而是jquery UI。所以你应该包括jqueryUI

<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

答案 1 :(得分:0)

这里是包含jQuery datepicker的整个代码。

你也可以在这里看到:https://jqueryui.com/datepicker/

&#13;
&#13;
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  
</head>
<body>
 
<p>Date: <input type="text" id="datepicker"></p>
 <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script type="text/javascript">
 
 
		$(function() {
			$( "#datepicker" ).datepicker();
		  });
	
  
  </script>
</body>
</html>
&#13;
&#13;
&#13;