//let username = document.getElementById('username');
//let email = document.getElementById('email');
//let password = document.getElementById('password');
//let password2 = document.getElementById('password2');
function check(arr) {
arr.forEach((input) => {
console.log(input);
})
}
// Addeventlisteners
document.getElementById('submit').addEventListener('click', (e) => {
e.preventDefault();
check([username, email, password, password2]);
})
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Form Validation</title>
</head>
<body>
<div class="container">
<h1>Register with us</h1>
<form action="">
<div class="row">
<label for="">Username</label>
<input id="username" type="text" placeholder="Enter username">
<small>Error message</small>
</div>
<div class="row">
<label for="">Email</label>
<input id="email" type="text" placeholder="Enter email">
<small>Error message</small>
</div>
<div class="row">
<label for="">Password</label>
<input id="password" type="password" placeholder="Enter password">
<small>Error message</small>
</div>
<div class="row">
<label for="">Confirm Password</label>
<input type="password" id="password2" placeholder="Enter password again">
<small>Error message</small>
</div>
<button id="submit">Submit</button>
</form>
</div>
<script src="app.js">
</script>
</body></html>
output when i clicked the submit button
**I even cleared my cache but then it is showing the input tags. Can anybody help me i am not able to find the solution.This is my first time asking question here so i really don't know how to post question **