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

126
Views
Javascript click action not triggering of input date

I am trying to trigger the opening of a calendar date picker when clicking on a related text field. My HTML looks like this:

<form action="test.html" method="post">
   <input type="date" id="dueDate" name="dueDate">
   <input type="text" id="dateText" name="dateText" onclick="dateTextClick()">
</form>

and my Javascript looks like this:

<script>
    function dateTextClick() {
        var $input = document.querySelector("#dueDate");
        $input.focus();
        $input.click();
    }
</script>

The first line does work, and the date input receives the focus. However, the click action is not triggered, so the date picker calendar does not appear.

In case it's relevant, this code is embedded in a Joomla article, but so far in my experience that hasn't made a difference to the use ofJavascript.

I would be grateful for any pointers as to how to fix this!

about 4 years ago · Santiago Gelvez
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!