- Create a global object to set the number of buttons to be created
- Create a main page element that will contain all the new elements
- Create a function to create page elements, adding the element type to a parent object. Include a parameter in the function for the inner content of the element.
- Loop through and create all the buttons, set a default total of 0 for each one. On click create a function that will update and output the current value of this element total. You can add styling to the buttons
- Add a class of “btn” to each new button so that they can be distinguished from the main total tally button. Create a button that will output all the current button total results.
- When the tally button is clicked create a function that will select all the elements with a class of “btn” and loop through them.
- For each element with the class of “btn” create a new list item element, output that into an unordered list on the main page. The list item contents should show the element total and the element textContent. You can also select the style to match the button style property values.