Make notepad with 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>
<h1>My Text Editor</h1>
<p></p>
<input placeholder="type something" id="text">
  <script src="index.js"></script>
</body>

</html>

let inp = document.querySelector("#text")
let p = document.querySelector("p")

inp.addEventListener("input", function(){
    console.log(inp.value);
    p.innerText = inp.value
})

Comments

Popular posts from this blog

practice test of Arithmetic Operations: