Watching input changes to enable submit button


Hi everybody!
My modal has a little form with a text input and a submit button. I would that button class change reactively from “disabled” to “enabled” when input value is typing, otherwise it remains in disabled class.
How can I do it with Meteor?


With good old Blaze you can do:

Template.home.onCreated(function () {
  this.text = new ReactiveVar();

  buttonEnabled: function() {
    return !!Template.instance().text.get();
  'change #input-id': function() {

This is an area where view models truly shine. If you’re using ViewModel then the code is reduced to:

  text: '',
  buttonEnabled: function() {
    return !!this.text();


Ir works! viewmodel package is awesome!
Thanks @manuel