How do I call the flatpickr calendar correctly in ajax?

  • 0
    There are blocks loaded via ajax on the page
    and in these blocks there is an input with a flatpickr calendar

    Tell me how to call the flatpickr calendar in ajax-loaded blocks.
    I do this - but it works very strangely - the calendar is called after a few clicks on the input

    $('body').ready(function(){
      $('body').on('click', 'input', function() {
        flatpickr('.calendar'), {
          dateFormat: 'd.m.Y H:i',
          enableTime: true,
          time_24hr: true,
        }
      })
    });
    AJAX Anonymous, Apr 13, 2019

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!