Change value of input text


#1

I have this code

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

How do I set the value of qty to 5 every time home is click? I tried to used text.value(“5”) but error occurred

Uncaught TypeError: string is not a function.

Any ideas?


#2

for reference you can do it using this code

Template.product.events
  'click #home': ->
    $('#qty').val 5

also answered in Stackoverflow


#3

The standard way without jQuery (if you prefer) is text.value=“5”


#4

@sashko it does not work :frowning: