I have this javascript code:
var TodoController = {
init: function() {
$(this).find('input.todo_check').click(function(){
$(this).parents('li.todo').done();
});
}
}
var Todo = {
done: function() {
$(this).toggleClass('done');
}
}
$(document).ready(function() {
$("li.todo").extend(Todo);
$("#todo_list").extend(TodoController).init();
});
When I click on a 'input.todo_check' I expect done() function, on 'li.todo', to be executed. But I get:
=> Uncaught TypeError: Object [object Object] has no method 'done'
What I'm doing wrong?
This statement should add 'done()' function to "li.todo" elements?:
$("li.todo").extend(Todo);
Thanks. JM