The given webpage lets the user add items to a to-do list. The up (?), down (?),
Question:
The given webpage lets the user add items to a "to-do" list. The up (?), down (?), and done (?) buttons don't do nything yet.
Examine the code
The given todo.js file implements three functions:
ready callback function - RegistersaddBtnClick()as the click callback function for the Add button.
addBtnClick()- Extracts the text typed into the text box and callsaddItem()to add the new item.
addItem()- Creates a list item for the newly entered item that contains the item text, up, down, and done buttons. Clicking the up and down buttons callsmoveItem(), and clicking the done button callsremoveItem().
Modifications
Make the following modifications using jQuery:
ModifymoveItem()to move the
ModifyremoveItem()to remove the
Add a keypress event callback function that has an event parameter. The function should calladdBtnClick()when the Enter key is pressed. The event.key is "Enter" when Enter is pressed.
After the modifications are complete, the user should be able to:
- Click the up button (?) to move the item up one spot.
- Click the down button (?) to move the item down one spot.
- Click the done button (?) to remove the item from the list.
- Typ3 a new item and press Enter to add the item without having to click the Add button.