You are on page 1of 2

<!

DOCTYPE html>

<html>

<head>

<title>Basic Form</title>

</head>

<body>

<form>

<label for="id">ID:</label>

<input type="text" id="id" name="id" required><br>

<label for="name">Name:</label>

<input type="text" id="name" name="name" required><br>

<label>Gender:</label><br>

<input type="radio" id="male" name="gender" value="male" required>

<label for="male">Male</label><br>

<input type="radio" id="female" name="gender" value="female" required>

<label for="female">Female</label><br>

<input type="radio" id="other" name="gender" value="other" required>

<label for="other">Other</label><br>

<label for="password">Password:</label>

<input type="password" id="password" name="password" required><br>

<label for="confirm-password">Confirm Password:</label>

<input type="password" id="confirm-password" name="confirm-password" required><br>


<input type="submit" value="Submit">

<input type="reset" value="Reset">

</form>

<script>

function validateForm() {

var password = document.getElementById("password").value;

var confirmPassword = document.getElementById("confirm-password").value;

if (password !== confirmPassword) {

alert("Passwords do not match");

return false;

return true;

</script>

</body>

</html>

You might also like