-3
<!DOCTYPE html>
<html lang = "pt-br">
<head>
<meta charset = "UTF-8"/>
<title>JS 1</title>
<style type="text/css">
* {
font-family: arial;
}
body {
margin: 0px;
}
.BG_1 {
height: 689px;
display: flex;
align-items: center;
justify-content: center;
}
.BOX_BG_1 {
width: 380px;
height: 240px;
border-radius: 10px;
background-color: gray;
}
.MIN_BOX_BG_1 {
width: 380px;
height: 80px;
color: white;
font-size: 25px;
line-height: 80px;
text-align: center;
}
.MSG_MIN_BOX_BG_1 {
outline: 0px;
border: 0px;
width: 250px;
height: 30px;
background-color: white;
padding-left-right: 10px;
text-align: center;
}
.BOTAO_MIN_BOX_BG_1 {
outline: 0px;
border: 0px;
height: 40px;
width: 75px;
color: green;
background-color: yellow;
border-radius: 5px;
}
.MIN_BOX_BG_1 {
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>
<body>
<div class = "BG_1">
<div class = "BOX_BG_1">
<div class = "MIN_BOX_BG_1">
Calc Space
</div>
<div class = "MIN_BOX_BG_1">
<input class = "MSG_MIN_BOX_BG_1" placeholder = "Digite aqui sua idade!"/>
</div>
<div class = "MIN_BOX_BG_1">
<BUTTON class = "BOTAO_MIN_BOX_BG_1" onclick = "Resposta()">Enviar</BUTTON>
</div>
</div>
</div>
<script type="text/javascript">
function Resposta() {
var x = document.getElementsByClassName('MSG_MIN_BOX_BG_1').value;
if(x <= 0)
document.getElementsByClassName('MIN_BOX_BG_1').innerHTML = 'Não válido!';
if(x>0)
document.getElementsByClassName('MIN_BOX_BG_1').innerHTML = 'Esse número é válido!';
}
</script>
</body>
</html>
What are you trying to do?
– David Mv
I just want to validate a data that the client will put in INPUT as valid or not. Obg!
– Julio Rodrigues