Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 28, 2022 01:37 pm GMT

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:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To