Reputation: 357
I'm following this guide and one of the selectors isn't working for me. Here is some of my code:
Template.todoItem.events({
'click .delete-todo': function(event){
event.preventDefault();
var documentId = this._id;
var confirm = window.confirm("Are you sure you want to delete this task?");
if(confirm){
Todos.remove({ _id: documentId });
}
}
'keyup [name=todoItem]': function(event){
console.log("You just tapped a key on your keyboard.");
}
});
And HTML of:
<template name="todoItem">
<li>
<input type="checkbox">
<input type="text" value="{{name}}" name="todoItem">
[<a href="#" class="delete-todo">Delete</a>]
</li>
</template>
When I try and run this code Meteor gives me the error: Errors prevented startup: While building the application: todos.js:32:5: Unexpected string
I think this is because of the 'keyup [name=todoItem]'
bit in the JavaScript. If anyone knows what's going on help would be much appreciated :)
Thanks, Alaister
Upvotes: 0
Views: 77
Reputation: 1091
It's a syntax error, the two event listeners need a comma between them.
On my mobile device, unable to format code.
Upvotes: 1