I am working on a David Meteor tutorial at http://meteortips.com/ .
How to insert an integer instead of a string in a submit form?
I think the next line should make it clear that this is an integer, but I'm not sure how to do this.
var playerScoreVar = event.target.playerScore.value;
Here is my whole code.
Template.addPlayerForm.events({ 'submit form': function(event){ event.preventDefault(); var playerNameVar = event.target.playerName.value; var playerScoreVar = event.target.playerScore.value; PlayersList.insert({ name: playerNameVar, score: playerScoreVar, }); event.target.playerName.value = "" event.target.playerScore.value = "" } });
source share