Skip to content

Commit 515814c

Browse files
committed
Fix: clearAllTasks function
1 parent 6131110 commit 515814c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<h1 id="todoTitle">ToDo App</h1>
1717

1818
<div class="enterTask">
19-
<input type="text" placeholder="Add your new todo" id="taskInput">
19+
<input type="text" placeholder="Add your new todo" id="taskInput" autofocus>
2020
<!-- PLus ICON -->
2121
<svg xmlns="http://www.w3.org/2000/svg" id="addSvg" height="1em" viewBox="0 0 448 512">
2222
<path

script.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ const completedTask = (task) => {
1515
const editTaskText = (task) => {
1616

1717
// make the task text editable
18-
const editTaskText = taskElement.querySelector(".taskText");
18+
const editTaskText = task.querySelector(".taskText");
1919
editTaskText.setAttribute("contenteditable", "true");
20+
editTaskText.focus();
2021
}
2122

2223
// add the task when click
@@ -61,7 +62,7 @@ taskContainer.addEventListener("click", (e) => {
6162
case 'task':
6263
break;
6364
case 'edit':
64-
editTaskText(clickedElement);
65+
editTaskText(taskElement);
6566
break;
6667
case 'delete':
6768
break;
@@ -74,6 +75,6 @@ clearAllTaskBtn.addEventListener("click", () => {
7475

7576
if(confirm("All the tasks will be cleared permanently."))
7677
{
77-
// taskContainer.removeChild();
78+
taskContainer.setHTML('');
7879
}
7980
});

0 commit comments

Comments
 (0)