【发布时间】:2014-01-08 08:29:10
【问题描述】:
我无法运行 jQuery 操作。我也尝试了其他功能,但没有。我想问题在于一如既往地处理静态文件。
notes.html:
<div>
<script type="text/javascript" src="static/js/jquery.js" ></script>
<script type="text/javascript" src="static/js/init.js" ></script>
<h2><p id="title" > <a href="/notes/get/{{ note.id }}/" >{{ note.title }}</a></p></h2>
<p id="body" > {{ note.body|lower|truncatewords:"10"}}</p>
</div>
init.js
$('#body').click(function(){
$('#body').hide();
});
【问题讨论】:
-
您是否将
click包含在$(document).ready()中? -
你是从 Django 服务器加载 jQuery 吗?
-
您的
static/js/jquery.js网址是否可以改为/static/js/jquery.js(注意前导斜杠)? -
@Jason 我需要做什么? .我正在从 Eclipse 运行 Django。请解释一下
-
我建议重写你的问题,包括你想要做什么、你是怎么做的、到目前为止你尝试了什么以及在 Eclipse 和浏览器中显示的任何错误消息控制台。
标签: javascript jquery django