This commit is contained in:
Karan 2021-11-25 19:56:34 +05:30 committed by GitHub
parent 1230ffbc47
commit 51c30e9e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,28 +0,0 @@
<!doctype html>
<html>
<head>
<title>JS Tester</title>
</head>
<body>
<div class="output"></div>
    <input type="text" name="myNum1">
    <input type="text" name="myNum2">
<script>
const eles = document.querySelectorAll("input");
const output = document.querySelector(".output");
eles.forEach(el => {
el.addEventListener("keydown", (e) => {
if (!isNaN(e.key)) {
output.textContent += e.key;
}
})
el.addEventListener("keydown", (e) => {
console.log(e.key);
})
el.addEventListener("paste", (e) => {
console.log('pasted');
})
})
</script>
</body>
</html>