html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Problem Code</title>
</head>
<body>
<section>
<div class="top">
<input type="date" autofocus id="date" value="2021-03-16">
<button class="button" >Calculate</button>
</div>
<div class="bottom">
<div class="box">
<h4 id="year">-</h3>
<span>Years</span>
</div>
<div class="box">
<h4 id="month">-</h3>
<span>Months</span>
</div>
<div class="box">
<h4 id="day">-</h3>
<span>Days</span>
</div>
</div>
</section>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
-webkit-user-select: none;
user-select: none;
}
body {
width: 100%;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #00f;
}
section {
position: relative;
width: 300px;
height: 270px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
border-radius: 10px;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// const date = document.getElementById("date");
// const button = document.querySelector('.button');
// const year = document.getElementById('year');
// const month = document.getElementById('month');
// const day = document.getElementById('day');
document.querySelector('.button').addEventListener ( 'click', function () {
var inputDate = document.getElementById("date").value;
console.log(inputDate.getDate() );
})
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run