How to use datetimepicker on input that was created on the fly using .append()?

How to use datetimepicker on input that was created on the fly using .append()?

Hi
I have a code that appends input fields. Now what I am trying to do is when a user click on any of the field that are generated on the fly then I need a datetimepicker to be displayed.




I have did this code but it is not working for me








  1.  $('.triggerOnPicker').on('focus', datetimepicker({ 
  2. timeFormat: "hh:mm TT", 
  3. changeMonth: true, 
  4. changeYear: true, 
  5. stepMinute: 5, 
  6. beforeShowDay: $.datepicker.noWeekends, 
  7. HourMin: 5, HourMax: 17, minDate: 0
  8. });




How can I get this code to work? note all of the inputs have the same class which is triggerOnPicker