【发布时间】:2016-05-18 06:58:22
【问题描述】:
当我单击日期字段时,它什么也不显示。我已经在 chrome 和 firefox 中对其进行了测试。但它不起作用
models.py
class ProfileEditForm(forms.ModelForm):
class Meta:
model = Profile
fields = ('date_of_birth', 'photo')
widgets = {'date_of_birth' : forms.DateInput(attrs={'class':'datepicker'})}
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link href="{% static "css/base.css" %}" rel="stylesheet">
<script>
$(document).ready(function() {
$('.datepicker').datepicker();
});
</script>
【问题讨论】:
-
你能检查你的控制台是否有任何错误吗?
-
没有错误,但显示如下:18/May/2016 07:14:41] "GET /account/edit/ HTTP/1.1" 200 2792 [18/May/2016 07:14: 41]“GET /static/css/base.css HTTP/1.1”304 0 @dreamweiver
-
@JagdeepSidhu 上面的评论是关于浏览器控制台的,而不是命令行输出。如果 Javascript 有问题,浏览器应该会给你错误。
-
它表明 $().datepicker 不是函数@achedeuzot