How to get value of an input text


I have this code:


    label(for="qty") Qty:
    input#qty.form-control(type="text", value="1", name="qty")
    button.btn.btn-default.addcart Add to Cart

  '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()



@chenroth this will just get the value of the button


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 :slight_smile:


sorry, I haven’t noticed that detail