There are a couple of features that we could improve. Let’s implement the CRUD (Create-Read-Update-Delete) for the item list.
We are already can create item list from the console (2.3) and also from the UI (2.4.3). So, it’s done.
What if you make a mistake and want to change the text on some of your to-do list. Furthermore, you can notice that the checkboxes states are not persistent when you reload the pages. Let’s fix both problems.
1.- You want to respond to a double click event showing up a text box, where the user can change the text. First, let’s add the HTML in the item-template template below the label tag.
<input class="edit" value="<%- title %>">
2.- If you refresh, you will notice that there are both displaying at the same time. So, you can hide them properly with the following CSS.
You can download the full working code so far in here and you can visualize the changes needed to implement the delete feature in here
Continue with the 4th part and learn about Backbone’s Routes!
Adrian Mejia is a full-stack web developer working at Cisco in Boston. Currently working at Cisco as a Software Engineer. Adrian enjoys writing books and posts about programming, technologies and nerdy stuff. Find our more here.