-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sauravkr818 - Task 1 #1
base: main
Are you sure you want to change the base?
Conversation
This adds todo webpage
This removes intetnal js DevCANS#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sauravkr818 I have added some comments. Please have a look
1. Building a To-Do List Without Framework/submission/index.html
Outdated
Show resolved
Hide resolved
Okay @Rohitrajak1807 @deepakgupta191199 bhaiya. |
This updates the UI and removes the bug DevCANS#1
|
|
Okay I will fix it soon. |
This fixes the issue of marking checkbox and then reloading DevCANS#1
<strong>Please add any item</strong> | ||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div>`; | ||
$("#save-info").html(clearInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should avoid the use of JQuery or any other library for a simple task which can be easily done without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used jQuery just to display confirmation messages to the user. Should I remove the display messages and keep it simple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do it without jQuery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay bhaiya give me some time.
todoList.length > 0 // if array length is null then do not show confirm msg. | ||
? `${confirm("Are you sure you want to delete your all items")} | ||
${localStorage.removeItem("todoList")} | ||
${(todoList = [])} // array made empty | ||
${renderList()}` | ||
: ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not do this. This is not at all readable and may not get properly formatted by eslint or other formatters.
Use a simple if
condition.
`${localStorage.removeItem("todoList")} | ||
${(todoList = [])} | ||
${renderList()}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to call functions inside template strings unless you are storing it in a variable.
And these statements do not return anything so it is of no use to call it in a template string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay got it.
try { | ||
if (localStorage.getItem("todoList")) { | ||
todoList = JSON.parse(localStorage.getItem("todoList")); | ||
renderList(); | ||
} | ||
} catch (e) { | ||
console.log(e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use this code just after defining the todoList
array.
} | ||
}; | ||
|
||
document.getElementById("todo-form").addEventListener("submit", (event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define event listeners at the end.
This adds todo webpage
UI completed
checkout here https://sauravkr818-todo.netlify.app/