An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
July 28, 2022 01:37 pm GMT
Original Link: https://dev.to/kodah/simple-to-do-list-made-with-sveltekit-and-tailwind--39nk
Simple to-do list made with sveltekit and tailwind !
HTML
{#each tasks as task} <div on:click={activeTask} class="w-full h-10 border-[#a181be] justify-between rounded-sm px-2 bg-[#F0D9FF] flex items-center cursor-pointer" > <p class="text-black " id="out">{task.text}</p> <img on:click={deleteTask(task.id)} class="w-6 cursor-pointer transition-transform ease-out duration-150 hover:-translate-y-1" src={Trashimg} alt="" /> </div> {/each}
Javascript / Svelte
let tasks = []; let msg = ''; function addTask() { if (msg === '') return; let _id = Date.now() * Math.random(); tasks = tasks.concat({ id: _id, check: false, text: msg}); msg = ''; } function deleteTask(id) { tasks = tasks.filter((element) => element.id !== id); }
Link to repository :
GitHub
Original Link: https://dev.to/kodah/simple-to-do-list-made-with-sveltekit-and-tailwind--39nk
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To