form event second




<!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" type="text" id="user" >
  <input placeholder="Password"  type="password" id="passw">
  <button>Register</button>
</form>
  <script src="index.js"></script>
</body>

</html>

 let form = document.querySelector("form")


form.addEventListener("submit", function(){
event.preventDefault()


})


let user = document.querySelector("#user")

user.addEventListener ("change", function(){
    console.log("input event");
    console.log(("final value ="), this.value);
} )
user.addEventListener ("input", function(){
    console.log("input event");
    console.log(("final value ="), this.value);
} )

Comments

Popular posts from this blog

practice test of Arithmetic Operations: