document.querySelector("form").onchange = function(e) {
var currentFormPage = e.target.parentElement.parentElement;
console.log(e.target.name + ": " + e.target.value);
if(currentFormPage.nextElementSibling) {
currentFormPage.classList.add("hidden");
currentFormPage.nextElementSibling.classList.remove("hidden");
}
};
* {
box-sizing: border-box;
}
.hidden {
display:none;
}
form {
width: 400px;
box-shadow: 2px 2px 2px lightgreen, 0px 0px 1px lightgreen;
padding: 20px 40px;
font-family: sans-serif;
border-radius: 5px;
}
.radio-choice {
display: flex;
height: 50px;
border-radius: 5px;
justify-content: center;
align-items: center;
position: relative;
box-shadow: 1px 1px 2px #ccc;
margin-bottom: 5px;
color: red;
cursor: pointer;
}
input[type='email'], input[type='button'] {
width: 100%;
border-radius: 10px;
border: none;
box-shadow: 1px 1px 1px #ccc
}
input[type='email'] {
margin-bottom: 5px;
border-bottom: 1px solid red;
height: 40px;
padding-left: 10px;
}
input[type='button'] {
background-color: lightgreen;
color: white;
font-size: 24px;
padding: 10px;
}
.radio-choice input {
position: absolute;
left: 10px;
top: 15px;
}
form h2 {
text-align: center;
font-weight: normal;
}