Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda