【发布时间】:2015-06-18 05:03:39
【问题描述】:
我有这个代码
product.jade
a#home(href="{{pathFor 'home'}}") Home
input#qty.form-control(type="text", value="1", name="qty")
product.coffee
Template['product'].events
'click #home': (e, template) ->
text = template.find("#qty")
???
return
如何在每次点击主页时将 qty 的值设置为 5?我尝试使用 text.value("5") 但发生错误
未捕获的类型错误:字符串不是函数。
有什么想法吗?
【问题讨论】:
-
文件名为
product.jade,但模板名称为header?这很好,但我只想确定哪个模板包含哪些元素。
标签: javascript node.js meteor coffeescript pug