<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content='width=device-width, initial-scale=1' name='viewport'/>
<title>jQuery UI Datepicker</title>
<link type="text/css" href="jquery-ui-1.8.16.custom/css/sunny/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<script src="jquery-ui-1.8.16.custom/js/jquery-1.6.2.min.js"></script>
<script scrc="jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script>
</head>
<body>
<h3>Date of Birth</h3>
<input type="text" name="birth_date" id="datepicker">
<script>
$(document).ready(function(){
$('#datepicker').datepicker();
});
</script>
</body>
</html>
爲什麼這不起作用?嘗試了幾次,但在調試中得到相同的錯誤:Datepicker不起作用
對象不支持屬性或方法'datepicker'。
看來你沒有包含datepicker.js和jquery-ui庫。 – 2014-09-27 12:24:31
我認爲jquery.js和jquery-ui中存在版本控制問題。只要包含他們的最新版本。 – 2014-09-27 12:28:45
你使用jQuery 1.6嗎?如果是,那麼我不確定它是否支持日期選擇器。更新jQuery插件至少1.7.2,它將工作http://jsfiddle.net/dimomohit/2js1cykh/。希望這可以幫助你。 – DimoMohit 2014-09-27 12:31:58