Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Javascript text replacemant same way like "Emiliy is away" game. Onkeydown issue

I'm making art web project where I wan't to replace user inputed text to my own phrases in infnity.

Similar way like in game "Emily is away", but that will be only one phrase repeat in infinity.

Something like this: "text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text. text"

When user will be typing, the result will be always the same phrase.

My code looks this way:

  function myFunction() {
    result.innerHTML = "TEXT";
  }
<input type="text" onkeydown="myFunction()">
<div id="result"></div>

I will be really glad for help.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

let myInput = document.querySelectorAll('input');

myInput.forEach(input => {
  input.addEventListener('keydown', function() {
    result.innerHTML += "TEXT ";
  });
})
<input type="text">
<div id="result"></div>

about 4 years ago · Juan Pablo Isaza Report

0

Is this what you mean? It will append the string to the existing output, rather than replacing it:

function myFunction() {
    result.innerHTML += "TEXT ";
  }
<input type="text" onkeydown="myFunction()">
<div id="result"></div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!