form even dom
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>replit</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="/action">
<input placeholder="User name" >
<button>Register</button>
</form>
<script src="index.js"></script>
</body>
</html>
let form = document.querySelector("form")
form.addEventListener("submit", function(){
event.preventDefault()
alert("form submit")
})
Comments
Post a Comment