JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Survay Form</title>
<meta charset="utf-8">
<meta name="viewport" width="device-width, initial-scale=1.0">
<link rel="stilesheet" href="survay.css">
</head>
<body>
<h1 id="title">Survay Form</h1>
<p id="description">a form that survays...</p>
<form id="survey-form">
<label id="name-label">
<input id="name" type="text" placeholder="your name" required>
</label><br>
<label id="email-label">
<input id="email" type="email" placeholder="your email" required>
</label><br>
<label id="number-label">
<input id="number" type="text" placeholder="age (optional)">
</label>
</form><br>
<p id="eRr"></p>
<form>
<select id="dropdown">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
<option>option 4</option>
</select>
</form><br>
<form>
<label for="aAA">
<input id="aAA" type="radio" value="aAA" name="aAa">aAA
</label>
<label for="AaA">
<input id="AaA" type="radio" value="AaA" name="aAa">AaA
</label>
<label for="AAa">
<input id="AAa" type="radio" value="AAa" name="aAa">AAa
</label>
<br>
<label for="bBB">
<input id="bBB" type="radio" value="bBB" name="bBb">bBB
</label>
<label for="BbB">
<input id="BbB" type="radio" value="BbB" name="bBb">BbB
</label>
<label for="BBb">
<input id="BBb" type="radio" value="BBb" name="bBb">BBb
</label>
</form>
<br>
<form>
<label for="xXX">
<input id="xXX" type="checkbox" value="xXX" name="xXx">xXX
</label>
<label for="XxX">
<input id="XxX" type="checkbox" value="XxX" name="xXx">XxX
</label>
<label for="XXx">
<input id="XXx" type="checkbox" value="XXx" name="xXx">XXx
</label>
<br>
<label for="zZZ">
<input...
JavaScript
function checkTheValue() {
var message, x;
x = (document.getElementById("number").value);
message = document.getElementById(“eRr”);
message.innerHTML = "";
try {
if (isNaN(x)) throw“ is not a number”;
if ((x).value == “”) throw“ is empty”;
if ((x).value > 9) throw“ is too high”;
if ((x).value < 1) throw“ is too low”;
} catch (err) {
message.innerHTML = "Input value " + err;
}
}