06. Form Elements πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

πŸ“– Implement a Shopping List Form

Implement the following user storys:

  • As an online shopper, I want to be able to add items to my shopping list so that I can view them all in one place.

  • As an online shopper, I want to be able to quickly add another item to my list.

Acceptance Criteria

  • It’s done when the form can be submitted and the value in the input field is captured and printed to the page as a list item.

  • It’s done when the form’s input field is cleared upon a successful submission.

πŸ“ Notes

Refer to the following documentation:

jQuery documentation on forms

Assets

The following image demonstrates the web application’s appearance and functionality:

A shopping list app shows an input field with a button to Add Item, above a shopping list.


πŸ’‘ Hints

  • Prevent the default behavior of the submit() event.

  • What jQuery form method can you use to retrieve the input field’s data?

πŸ† Bonus

If you have completed the activity and want to further your knowledge, work through the following challenge:

  • How can we reset form elements using plain JavaScript?

Use Google or another search engine to research this.


βœ… Solutions

Solutions Click Here