File tree Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ document . getElementById ( "btn" ) . addEventListener ( "click" ,  joke ) ; 
2+ 
3+ async  function  joke ( )  { 
4+   let  config  =  { 
5+     headers : { 
6+       Accept : "application/json" , 
7+     } , 
8+   } ; 
9+ 
10+   let  a  =  await  fetch ( "https://icanhazdadjoke.com/" ,  config ) ; 
11+   let  b  =  await  a . json ( ) ; 
12+   document . getElementById ( "content" ) . innerHTML  =  b . joke ; 
13+ } 
Original file line number Diff line number Diff line change 1+ < html  lang ="en "> 
2+   < head > 
3+     < meta  charset ="UTF-8 " /> 
4+     < meta  http-equiv ="X-UA-Compatible " content ="IE=edge " /> 
5+     < meta  name ="viewport " content ="width=device-width, initial-scale=1.0 " /> 
6+     < title > Dad Jokes</ title > 
7+     < link  rel ="stylesheet " href ="style.css " /> 
8+   </ head > 
9+   < body > 
10+     < div  id ="container "> 
11+       < h1 > Dad Jokes 😜</ h1 > 
12+       < button  id ="btn " class ="btn "> Joke</ button > 
13+       < div  id ="content "> </ div > 
14+     </ div > 
15+ 
16+     < script  src ="app.js "> </ script > 
17+   </ body > 
18+ </ html > 
Original file line number Diff line number Diff line change 1+ body  {
2+   background :  # 77bfa1
3+ }
4+ 
5+ h1  {
6+   margin :  auto;
7+   font-size :  10vh  ;
8+ }
9+ 
10+ # container  {
11+   display :  flex;
12+   flex-direction :  column;
13+   justify-content :  center;
14+   align-items :  center;
15+   font-family :  sans-serif;
16+ }
17+ 
18+ # btn  {
19+   margin-top :  20vh  ;
20+   border :  none;
21+   outline :  none;
22+   background :  transparent;
23+   color :  white;
24+   border :  2px   solid white;
25+   padding :  10px   50px  ;
26+   cursor :  pointer;
27+ }
28+ 
29+ # content  {
30+   margin :  auto;
31+   padding :  4vh  ;
32+   font-size :  1.2rem  ;
33+   max-width :  700px  ;
34+   margin-top :  20px  ;
35+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments