<!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