Get text input values without using submit

Is there a way to get Meteor textbox values without using event submit?

Right now I have a simple input box:

<input type="text" class="form-control codeText"  placeholder="Enter Code" size ="10" />

I’m not having luck trying to read it with this:

  var x = $('.codeText').text();
  console.log(" Submit button clicked:", x);

Where is this code? What’s actually happening? Are you getting any errors?

Isn’t it:

var x = $('.codeText').val();

Yes, I believe .val() is what @xamlit is looking for.

Worked! Awesome thanks guys! :slight_smile:

You can use Template.find( ‘jquery selector’ ).value
Before this , you must pass template as function parameter like this:

‘click .button’: function(template){
console.log(template.find( ‘jquery selector’ ).value);
}

Yes, for example:

'submit form': function(e, tmpl) {
    e.preventDefault();
    var password = tmpl.find('#password').value;
    //code...
}