From d37b25036185270222e0494e9fd4d7cba0935f48 Mon Sep 17 00:00:00 2001 From: Hassan Samo Date: Sun, 2 Oct 2022 23:48:52 +0500 Subject: [PATCH 1/2] Changed the CSS file to beautify and make the site responsive by using dynamic units & somewhat modified the HTML for a good accessibility --- app.js | 26 ++++--- index.html | 39 +++++++---- styles.css | 201 ++++++++++++++++++++++++++++++++--------------------- 3 files changed, 162 insertions(+), 104 deletions(-) diff --git a/app.js b/app.js index 52ac219..9c2faad 100644 --- a/app.js +++ b/app.js @@ -13,19 +13,23 @@ for (i = 0; i < myNodelist.length; i++) { var close = document.getElementsByClassName("close"); var i; for (i = 0; i < close.length; i++) { - close[i].onclick = function() { + close[i].onclick = function () { var div = this.parentElement; div.style.display = "none"; - } + }; } // Add a "checked" symbol when clicking on a list item -var list = document.querySelector('ul'); -list.addEventListener('click', function(ev) { - if (ev.target.tagName === 'LI') { - ev.target.classList.toggle('checked'); - } -}, false); +var list = document.querySelector("ul"); +list.addEventListener( + "click", + function (ev) { + if (ev.target.tagName === "LI") { + ev.target.classList.toggle("checked"); + } + }, + false +); // Create a new list item when clicking on the "Add" button function newElement() { @@ -33,7 +37,7 @@ function newElement() { var inputValue = document.getElementById("myInput").value; var t = document.createTextNode(inputValue); li.appendChild(t); - if (inputValue === '') { + if (inputValue === "") { alert("You must write something!"); } else { document.getElementById("myUL").appendChild(li); @@ -47,9 +51,9 @@ function newElement() { li.appendChild(span); for (i = 0; i < close.length; i++) { - close[i].onclick = function() { + close[i].onclick = function () { var div = this.parentElement; div.style.display = "none"; - } + }; } } diff --git a/index.html b/index.html index d7fa301..5aef2c9 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,23 @@ - - - To Do List - - - -
-

My To Do List

- - Add -
+ + -