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

105
Views
Trigger input's calendar from js

I would like to trigger nativ browser's calendar from js.

I have a page where users want to see dates on different formats (choosen between 30/03/2022, monday 12 mars 1911, etc etc ), but they have to be able to edit these dates. Actual solution would be to show a text[input=text], to convert it under the hood with a $input.prop('type', 'text') on click events; and to trigger a new click on the element. Well, it doesn't trigger the calendar.

<input data-type="date" type="text" >

<script>
$el = $('input[data-type=date]');

$el.on('click', (e, el) => {
  $el = $(el);

  $input.prop('type', 'date');
  // convert format from required one to 06-06-2066
  $input.trigger('click');
});

$el.on('blur', (e, el) => {
  $el = $(el);

  // convert format from 06-06-2066 to required one
    $input.prop('type', 'text');
});
</script>
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!