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

178
Views
How to translate completion suggestions by clicking the word on suggestion bar?

I can only use HTML, CSS, and Javascript for this project. The app is a translator. I did most of it, but I have a problem with translating the word which I select in the suggestions (I did create suggestion thing on javascript), it translates the text when I put it on my own, but idk how to do it by selecting it on the suggestion part, any help would be appreciated. HTML code is below.

function checkfortranslate(){
    var input = document.getElementById("input").value;
    var output = document.getElementById("output");
    input = input.toLowerCase();

    if(input=="able"){
        output.innerHTML = "привет";
    }
    else if(input=="about"){
        output.innerHTML = "привет";
    }
    else if(input=="allow"){
        output.innerHTML = "привет";
    }
    else if(input=="above"){
        output.innerHTML = "благодарю вас";
    }
    else if(input=="abroad"){
        output.innerHTML = "привет";
    }
    else if(input=="accident"){
        output.innerHTML = "привет";
    }
}
<h2>SIMPLE ENGLISH TRANSLATOR</h2>
<form autocomplete="off">
  <div>
    <input id="input" type="text" placeholder="Write text to translate" onkeyup="checkfortranslate()">
    <ul class="list"></ul>
    <div id="output" style="display: inline;">[Translation]</div>
  </div>
</form>

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

0

You can use html datalist element.

<datalist id="input" type="text" placeholder="Write text to translate" onkeyup="checkfortranslate()">
     <option value="able">
     ...
     <option value="accident">
    </datalist>

Edit:

<input id="input" type="text" placeholder="Write text to translate" onkeyup="checkfortranslate()" list="list">
 <datalist id="list">
     <option value="able">
     ...
     <option value="accident">
    </datalist>
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!