Skip to content

Instantly share code, notes, and snippets.

@ssdev-95
Created June 13, 2022 11:08
Show Gist options
  • Select an option

  • Save ssdev-95/4f8c4d8cdfb783ec8ff9a928790abc42 to your computer and use it in GitHub Desktop.

Select an option

Save ssdev-95/4f8c4d8cdfb783ec8ff9a928790abc42 to your computer and use it in GitHub Desktop.
Irmão tezt input
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<input type="number" id="txt" />
<button onclick="clicar()">clicar</button>
<hr/>
<p id="res"></p>
<!-- ScrollReaveal Lib -->
<script src="./main.js"></script>
</body>
</html>
const input = document.querySelector("#txt")
const res = document.querySelector('#res')
function clicar() {
const idade = input.value
let resposta = ""
if (idade >= 18 && idade <= 69) {
resposta = "vai votar"
} else if (idade >= 16 && idade <= 17) {
resposta = "Não precisa votar, mas pode"
} else if (idade >= 0 && idade <= 15) {
resposta = "Não vota"
} else if (idade >= 70) {
resposta = "Acima de 70 anos, voto não obrigatório"
} else {
resposta = "[Erro]"
}
res.innerText = resposta
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment