Week 15: Lab #30
User Created Object Instances
DUE: Thursday, 5/4 @ 4:30pm
Create a page that allows a user to input property values and create new instances of a class. Print results to the screen. You will need to design a class to hold data about a subject of your choosing that has a minimum of 5 different properties.
Your page should have:
- Five (5) text input fields to allow the user to create a new class instance (so if we are doing dogs we could have breed, name, weight, color, and age).
- A drop-down menu listing the properties of your custom class, allowing the user to select what to sort by.
- A submit button to save newly entered data as a new class instance within an array.
- An empty div to which you will write the results with the id "results".
When the submit button has been pressed, the behavior of your JavaScript should:
- Create a new class instance (an object) using the values entered by the user.
- Store the class instance in an array.
- Sort the array based on the property that the user selected from the drop-down (or the default value).
- Loop over the array and write the object data out to the page.
When the user changes the property to sort on from the drop-down menu, it should trigger a "change" event and re-sort the array and print them out to the page replacing any previous results.
Upload your completed lab by the due date specified above and make sure that you add a working link to it on your class page, otherwise it will not be reviewed and you will not receive credit.