Computers and Technology
Computers and Technology, 07.08.2021 02:30, cymoneej

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
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:30, lauriepdx
The cm is responsible for overseeing the actions of the crisis management team and coordinating all crisis management efforts in cooperation with disaster recovery and/or business continuity planning, on an as-needed basis
Answers: 1
image
Computers and Technology, 23.06.2019 01:40, littlebirdd987
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
image
Computers and Technology, 23.06.2019 15:00, lopez7512
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
image
Computers and Technology, 23.06.2019 21:00, shyshy1791
Which set of steps will organize the data to only show foods with more than 100 calories and rank their sugar content from greatest to least?
Answers: 1
Do you know the correct 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: