subject

The given web page lets the user add items to a "to-do" list. The up (↑), down (↓), and done (✓) buttons don't do anything yet. Examine the code
The given todo. js file implements three functions:
ready callback function - Registers addBtnClick() as the click callback function for the Add button.
addBtnClick() - Extracts the text typed into the text box and calls addItem() 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 calls moveItem(), and clicking the done button calls removeItem().
Modifications
Make the following modifications using jQuery:
Modify moveItem() to move the at the given fromIndex to the given toIndex. Ex: moveItem(0, 1) should move the first (at index 0) to the second (at index 1). Use the jQuery methods detach(), insertBefore(), and insertAfter() where appropriate. Modify removeItem() to remove the at the given index. Ex: removeItem(2) should remove the third (at index 2). Use the jQuery remove() method to remove the appropriate . Add a keydown event callback function that calls addBtnClick() when the Enter key (keyCode 13) 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 down button (✓) to remove the item from the list. Type a new item and press Enter to add the item without having to click the Add button. todo. js: // HTML for the up, down, and done buttons const upButtonHtml = '↑'; const downButtonHtml = '↓'; const doneButtonHtml = '✓'; $(function() { $("#addBtn").click(addBtnClick); // TODO: Add item if user presses Enter }); function addBtnClick() { let itemText = $("#newItemText").val().trim(); // Don't add empty strings if (itemText. length !== 0) { addItem(itemText); // Clear text and put focus back in text input $("#newItemText").val("").focus(); } } function addItem(item) { // Create a new for the list let $newItem = $(`${item}`);
// Up button moves item up one spot
let $upButton = $(upButtonHtml).click(function() {
let index = $(this. parentElement).index();
moveItem(index, index - 1);
});
// Down button moves item down one spot
let $downButton = $(downButtonHtml).click(function() {
let index = $(this. parentElement).index();
moveItem(index, index + 1);
});
// Add click hander for done button
$doneButton = $(doneButtonHtml).click(function() {
// Remove item from list
let index = $(this. parentElement).index();
removeItem(index);
});
// Add all buttons to the new item, and add new item to list
$newItem. append($upButton, $downButton, $doneButton);
$("ol").append($newItem);
}
function moveItem(fromIndex, toIndex) {
// TODO: Complete the function
}
function removeItem(index) {
// TODO: Complete the function
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 23:30, TheBurntToast
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, juliajordan427
Best laptops for college [$100-$500 range]?
Answers: 2
image
Computers and Technology, 24.06.2019 04:10, kris1920
Write a program that reads a set of floating-point values. ask the user to enter the values, then print • the average of the values. • the smallest of the values. • the largest of the values. • the range, that is the difference between the smallest and largest. of course, you may only prompt for the values once.
Answers: 3
image
Computers and Technology, 24.06.2019 17:00, kappy10
Anew author is in the process of negotiating a contract for a new romance novel. the publisher is offering three options. in the first option, the author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. in the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. in the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000. the author has some idea about the number of copies that will be sold and would like to have an estimate of the royal- ties generated under each option. write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold. the program then outputs he royalties under each option and the best option the author could choose. (use appropriate named constants to store the special values such as royalty rates and fixed royalties.
Answers: 1
You know the right answer?
The given web page lets the user add items to a "to-do" list. The up (↑), down (↓), and done (✓) but...

Questions in other subjects: