+ 1
Does anyone know how I can know what the user is typing? I tried to make it like this 😅
7 Answers
+ 6
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<input type="text">
<p></p>
<script>
document.querySelector("input").addEventListener("input",()=>{
document.querySelector("p").innerHTML=document.querySelector("input").value;
});
</script>
</body>
</html>
+ 4
💗💗
+ 3
with that e.key you get only the key.
If you want to read the text entered in the input element, add event "change" or "input" to that input element and read the entire value. keydown to that input works too.
+ 2
Try the above-mentioned
+ 2
Thanks to all 🤗
+ 2
cool! i like what you did that seems perfect.
0
Cool