Creating CheckList Rows on Submit

Next, you will add a method to CheckList that will use the Row constructor to create Row instances. It will append each Row instance’s $element to the live DOM on the page.

In checklist.js, add a method to CheckList.prototype called addRow. It should accept an argument called coffeeOrder, which will be an object that contains all of the data for a single coffee order.

In this new method, create a new Row instance by calling the Row constructor and passing it the coffeeOrder object. Assign the new instance to the variable rowElement. Then, append the rowElement’s $element property (which contains the DOM subtree) to the CheckList instance’s $element property (which is a reference to the container for ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.