Search code examples
javascriptdatetimepickerflatpickr

Get user's datetime chosen value using flatpickr


Flatpickr has the option so that user can pick date/ datetime.

I m wondering how can I post user's chosen datetime to server-side.


Solution

  • You need to put your html tag into a <form> and to set its name. That way if you post the form, you will be able to reach the value by the name attribute's value. I advise you to read about html forms if you choose this approach.

    You can also send it via AJAX if you read the value. This is how you can read the value via Javascript. I advise you to read about AJAX if you intend to use this approach.