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

188
Views
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
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!