Skip to content

Commit

Permalink
reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhk9919 committed Oct 14, 2024
1 parent a978a09 commit 547bef4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ <h1 class="subtitle">Todo-List</h1>
<button class="js-cancel-button" title="Cancel">
<i class="fa-solid fa-times"></i>
</button>
<button class="js-reset-button" onclick="resetForm();">
<img src="reset2.png" alt="Reset" width="16" height="16" /> Reset
</button>

</div>
<div id="js-success-notification" style="display: none">
<p>Task completed 🎉</p>
Expand Down
12 changes: 12 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ 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
16 changes: 15 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Londrina+Outline&display=swap');

body {
Expand Down Expand Up @@ -195,6 +195,20 @@ h1 {
color: white;
}

.js-reset-button {
background-color: #f44336; /* Red color */
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 5px;
}
.js-reset-button:hover {
background-color: #d32f2f; /* Darker red */
}

.js-delete-button:hover {
background-color: darkred;
}
Expand Down

0 comments on commit 547bef4

Please sign in to comment.