简体   繁体   English

带有NodeJS和Jade的innerHTML

[英]innerHTML with NodeJS and Jade

I'm trying to change the value of a number that is displayed with Jade from Javascript. 我正在尝试使用Javascript更改Jade显示的数字的值。 I have a paragraph with id number, then get that in Javascript and try to change it using innerHTML, however nothing happens. 我有一个带有id号的段落,然后在Javascript中获取并尝试使用innerHTML更改它,但没有任何反应。

p#number 0

Above is how the paragraph is defined in jade. 以上是如何在玉中定义段落。

Then I get the element in Javascript and attempt to change the value like so. 然后我在Javascript中获取元素并尝试更改值。

var number = document.getElementById("number");
number.innerHTML("1");

The object returned by document.getElementById is not null, however the .value() of that object is undefined. document.getElementById返回的对象不为null,但该对象的.value()未定义。

innerHTML不是一个函数。

number.innerHTML = "1";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM