File tree Expand file tree Collapse file tree 3 files changed +116
-0
lines changed
Expand file tree Collapse file tree 3 files changed +116
-0
lines changed Original file line number Diff line number Diff line change 1+ button = document . querySelector ( ".bttn" )
2+ console . log ( button )
3+ item = document . querySelector ( ".item" )
4+ todo = document . querySelector ( ".todo" )
5+
6+
7+ button . addEventListener ( "click" , ( event ) => {
8+ console . log ( "button was clicked" )
9+ console . log ( item . value )
10+
11+ if ( item . value != "" ) {
12+ console . log ( "You have entered some text" )
13+
14+ newli = document . createElement ( "li" )
15+ style ( newli )
16+
17+ let msg = item . value
18+ console . log ( msg )
19+ newli . innerText = msg ;
20+ todo . appendChild ( newli )
21+ item . value = ""
22+ }
23+ else {
24+ console . log ( "Enter some text" )
25+ }
26+
27+
28+ } )
29+
30+
31+ function style ( newli ) {
32+ newli . style . backgroundColor = "#FFE7E7" ;
33+ newli . style . margin = "6px"
34+ newli . style . width = "80%"
35+ newli . style . borderRadius = "6px"
36+ newli . style . textAlign = "left"
37+ newli . style . padding = "3px"
38+ }
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > To Do List</ title >
7+ < link rel ="stylesheet " href ="style.css ">
8+ </ head >
9+ < body >
10+ < div class ="maincontainer ">
11+ < div class ="head "> < h2 class ="h1 "> To Do List</ h2 > </ div >
12+ < div class ="text ">
13+ < input type ="text " class ="item ">
14+ < button class ="bttn "> Add to List</ button >
15+ </ div >
16+ < ul class ="todo " list-style ="none ">
17+
18+ </ ul >
19+
20+ </ div >
21+
22+ < script src ="app.js "> </ script >
23+ </ body >
24+ </ html >
Original file line number Diff line number Diff line change 1+ * {
2+ margin : 0 ;
3+ padding : 0 ;
4+ }
5+
6+ .maincontainer {
7+ display : flex;
8+ justify-content : center;
9+ text-align : center;
10+ flex-direction : column;
11+ margin : 5% 30% 5% 30% ;
12+ padding : 20px 0 15% 0 ;
13+ background-color : # CAA6A6 ;
14+ border-radius : 10px ;
15+
16+ }
17+
18+ .h1 {
19+ float : left;
20+ margin-bottom : 10% ;
21+ padding-left : 5px ;
22+ color : # 611d32 ;
23+ }
24+ .item {
25+ background-color : white;
26+ border-radius : 10px ;
27+ border : none;
28+ padding : 7px ;
29+ float : left;
30+
31+
32+ }
33+ .bttn {
34+ border : none;
35+ border-radius : 10px ;
36+ background-color : # 944E63 ;
37+ color : white;
38+ padding : 6px ;
39+ float : left;
40+ margin-left : 4px ;
41+
42+ }
43+ .text {
44+ padding-left : 5px ;
45+ }
46+
47+
48+ body {
49+ background-color : # 944E63 ;
50+ }
51+
52+ ul {
53+ list-style : none;
54+ }
You can’t perform that action at this time.
0 commit comments