JSFiddle - React, Tailwind, and code Playground

by rjasoriano

HTML

<html>
<body>  
     Name <input type="text" id="name"> <br> <br>
     Age <input type="number" id="age"> <br> <br>      
     <input type="radio" name="occupation" id="student" value="s">Student<br><br>
     <div id="school" hidden>
       School<input type="text"><br>
       Address<input type="text"><br><br>
     </div>
     <input type="radio" name="occupation" id="employee" value="e">Employee<br><br>
     <div id="office" hidden>
       Company<input type="text"><br>
       Address<input type="text"><br><br>
     </div>
     <button id="submit">Submit</button>
</body>
</html>

CSS

button{
  background-color: blue;
  color: white;
}

JavaScript

$('#submit').click(function(){
	age = $('#age').val();
   
  if(age >= 18){
 		alert('Adult');
  }else{
  	alert('Minor Age');
  }
});

$("#student").click(function(){
	$("#school").toggle()
  $("#office").hide()
})

$("#employee").click(function(){
	$("#office").toggle()
  $("#school").hide()  
})