site/examples/todo/js/todos/todos.js
function (el) {
			var value = can.trim(el.val()),
				todo = el.closest('.todo').data('todo');

			// If we don't have a todo we don't need to do anything
			if (!todo) {
				return;
			}

			if (value === '') {
				todo.destroy();
			} else {
				todo.attr({
					editing : false,
					text : value
				}).save();
			}
		}
function (el) {
			var value = can.trim(el.val()),
				todo = el.closest('.todo').data('todo');

			// If we don't have a todo we don't need to do anything
			if (!todo) {
				return;
			}

			if (value === '') {
				todo.destroy();
			} else {
				todo.attr({
					editing : false,
					text : value
				}).save();
			}
		}
function ( el ) { var value = can . trim ( el . val ( ) ) , todo = el . closest ( '.todo' ) . data ( 'todo' ) ; // If we don't have a todo we don't need to do anything if ( ! todo ) { return ; } if ( value === '' ) { todo . destroy ( ) ; } else { todo . attr ( { editing : false , text : value } ) . save ( ) ; } }
Update a todo
Update a todo