how to bind plugin with a div fetched via Ajax?

how to bind plugin with a div fetched via Ajax?

I'm trying to add a DateTimePicker plugin to a JQM app. Everything works when the HTML code is static in my app but when I pull the HTML via Ajax the plugin cease to initialize (I checked and all the plugin files loads to browser and there is no error in console, just nothing happens).

I'm sure this happens because plugin expects a HTML tag to hold on to ("input" in this case) which is not there onload - it shows when the Ajax fetches it from server file which takes a second.

The code is simple.

The plugin (this is pulled by Ajax into the HTML file):

 
  1. <input type="text" data-field="datetime" readonly>
  2. <div id="dateBox"></div> // space for plugin's calendar

Plugin init:

 
  1. $(document).on('pageshow', '#page-id-where-input-is-appended', function() {
  2. $("#dateBox").DateTimePicker();
  3. });

I suppose that solving this problem means to use appropriate JQM method when initializing. I used pageshow, and few different methods that works after the page DOM is ready - from pageinit to pagechange. With no success.

Any tips?