Search code examples
jqueryjquery-uidatepickertooltipster

How do you add jQuery datepicker to a text field in a tooltipster tooltip?


I have a jQuery dialogue box that displays a table and for the first header I have a Tooltipster that displays a dateStart and dateEnd input in order to apply a filter to the table. I want to use the jQuery datepicker within these inputs to select the date range however the datepicker doesnt show inside tooltipster. Can this be done?

Tooltip:

$jq('.dateFilters').tooltipster({
content: $("table" StartDate  "input class='datepicker' type='text' name='dateFilterStart' " +
            EndDate "input class='datepicker' type='text' name='dateFilterEnd'
});

jQuery:

$jq(".datepicker").datepicker();

Solution

  • The plugin documentation suggests you should do this in the functionReady option:

    $jq('.dateFilters').tooltipster({
        content: /* ... your stuff here ... */,
        functionReady: function() { $jq(".datepicker").datepicker(); }
    });
    

    Disclaimer: I've never used this plugin. This answer is based purely on the documentation provided in the link above.