ccfiel
1
I have this code:
product.jade
template(name="product")
label(for="qty") Qty:
input#qty.form-control(type="text", value="1", name="qty")
button.btn.btn-default.addcart Add to Cart
product.coffee
Template['product'].events
'click .addcart': (event, template) ->
????
How do I get the value of input text qty
? I tried the event variable but its limited in the button. Any ideas?
You can use jQuery like $('#qty').val()
$(event.currentTarget).val()
ccfiel
4
@chenroth this will just get the value of the button
ccfiel
5
Ok I found the answer it should be
'click .addcart': (event, template) ->
qty = template.find('#qty').value
You can see here the documentation about template.find()
Also posted it in stackoverflow and got the answer 
2 Likes
right
sorry, I haven’t noticed that detail