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

200
Vistas
How do I wrap this html input field with my voice to text script

This is my html form input

<form method="GET" action="">
    {% csrf_token %}
    <button class="btn btn-primary" action="" style="background-color: dodgerblue;">Search</button>
<input id="q" name="qq" type="text" placeholder="Enter search text here" style="width: 500px;">

This is my voice to text script,

<input type="text" name="" id="speechToText" placeholder="Speak Something" onclick="record()">

    <!-- Below is the script for voice recognition and conversion to text-->
    <script>
        function record() {
            var recognition = new webkitSpeechRecognition();
            recognition.lang = "en-GB";

            recognition.onresult = function(event) {
                // console.log(event);
                document.getElementById('speechToText').value = event.results[0][0].transcript;
            }
            recognition.start();

        }
    </script>

I obviously want to get rid of the secondary text field and wrap the onclick="record()" with the primary search button like this.

<input id="q" name="qq" type="text" placeholder="Enter search text here" style="width: 500px;" onclick="record()">

but when I do this, voice to text does not work anymore. What am I doing wrong? I also want to add a logic that the voice to text activates only when the user clicks a button. Please give some solutions. Thank you. Have a blessed day.

about 4 years ago · Juan Pablo Isaza
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