Skip to content

Commit

Permalink
managed the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhk9919 committed Oct 14, 2024
1 parent 59035f7 commit a87eb77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ <h1 class="subtitle">Todo-List</h1>
<option value="completed">Completed</option>
</select>
<button class="js-reset-button" onclick="resetForm();">
<img src="assets/reset2.png" alt="Reset" width="16" height="16" /> Reset
<img src="assets/reset2.png" alt="Reset" width="16" height="16" />
Reset
</button>
</div>
</div>
Expand Down
25 changes: 13 additions & 12 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ function cancelEditTodo() {
addButton.appendChild(addIcon);
}

const resetForm = () => {
// Get the input fields
const nameInput = document.querySelector('.js-name-input');
const dateInput = document.querySelector('.js-date-input');
const timeInput = document.querySelector('.js-time-input');

// Clear their values
nameInput.value = '';
dateInput.value = '';
timeInput.value = '';
};

function updateTodoList() {
// Sort todoList based on the current sort method
let filteredTodos = todoList;
Expand Down Expand Up @@ -181,18 +193,6 @@ function updateTodoList() {
: priorityOrder[b.priority] - priorityOrder[a.priority];
}
});

function resetForm() {
// Get the input fields
const nameInput = document.querySelector('.js-name-input');
const dateInput = document.querySelector('.js-date-input');
const timeInput = document.querySelector('.js-time-input');

// Clear their values
nameInput.value = '';
dateInput.value = '';
timeInput.value = '';
}

const addElement = document.querySelector('.js-add-html');
todoListhtml = '';
Expand Down Expand Up @@ -231,6 +231,7 @@ function updateTodoList() {
button.addEventListener('click', (event) => {
const index = event.currentTarget.getAttribute('data-index');
deleteTodo(index);
resetForm();
});
});

Expand Down

0 comments on commit a87eb77

Please sign in to comment.