Tell us what’s happening:
Hey, I am stuck on step 34 of the todo-app workshop. It asks write some logic so that a modal is shown if either titleInput, dateInput, or descriptionInput have a value.
I am failing on the following test:
If any of the input fields has a value, then the confirmation dialog should display. Otherwise, the reset function should be called.
I have tried both
closeTaskFormBtn.addEventListener("click", () => {
if ( titleInput.value.length > 0 || dateInput.value.length > 0 || description.value.length > 0 ) {
confirmCloseDialog.showModal()
} else {
reset()
};
});
as well as
closeTaskFormBtn.addEventListener("click", () => {
if ( titleInput.value !== "" || dateInput.value !== "" || description.value !== "") {
confirmCloseDialog.showModal()
} else {
reset()
};
});
Thank you!
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
closeTaskFormBtn.addEventListener("click", () => {
if ( titleInput.value.length > 0 || dateInput.value.length > 0 || description.value.length > 0 ) {
confirmCloseDialog.showModal()
} else {
reset()
};
});
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0
Challenge Information:
Build a Todo App using Local Storage - Step 34