Create it in a div and then put it, this is the easiest way.
<div id="datepickerholder" style="display: none;">
<div id="datepicker"></div>
</div>
<a id="pop">pop datepicker</a>
and js
<script>
$(function() {
$("#datepicker").datepicker();
$("#pop").click(function(){
$("#datepickerholder").show();
});
});
</script>
You can also create an instance after clicking, which means that there is no hidden container of
another JS, but it still works
<div id="datepicker"></div>
<a id="pop">pop datepicker</a>
<script>
$(function() {
$("#pop").click(function(){
$("#datepicker").datepicker();
});
});
</script>
Repás source
share