我正在教自己Django,并决定尝试一些JS功能。我在JS脚本中包含了一个简单的文本更改功能(来自w3schools)来尝试。该应用程序是blog
,JS脚本生活在blog/static/blog/test.js
。那里只有一个功能:
function myFunction() {
document.getElementById("demo-btn").innerHTML = "Text changed.";
}
这与blog/templates/blog/post_list.html
,id="demo-btn"
中的按钮相关联。
网站住在这里:http://andreyito.pythonanywhere.com
它在我的localhost上运行正常,但是当我把它推到pythonanywhere
时,没有任何反应(点击Click me
按钮应该改变按钮上方的文本。)
这感觉就像我要遗漏的一件小事,但我无法轻易解决这个问题。回购这里:https://github.com/Don86/djgirls