jquery - datetimepicker dissappears upon selection -
i have datetimepicker.
<input id="all-day-event-date" type="text">
it input textbox. trigger focus when document loads:
$('#all-day-event-date').trigger("focus");
and happens have input field , calendar/picker appear, expected.
$("#all-day-event-date").datetimepicker({ timepicker: false, onchangedatetime: function(dp, $input) { var datetime = $input.val(); var date = datetime.split(" ")[0]; $input.val(date); } });
it looks this:
however, select date, calendar dissapears:
how make stay?
this question different 1 asked previously. when attempt inline solution:
<div style="overflow:hidden;"> <div class="form-group"> <div class="row"> <div class="col-md-8"> <div id="datetimepicker12"></div> </div> </div> </div> <script type="text/javascript"> $(function () { $('#datetimepicker12').datetimepicker({ inline: true, sidebyside: true }); }); </script> </div>
what happens this:
and online appears when press home button:
this not behavior want. want calendar there loads , never dissapear afterwards, letting user select , reselect without having click additional boxes.
add focusout remove focus datepicker input box on selecting date
$('#all-day-event-date').focusout();
now, datepicker should appear again after focus on input .
here fiddle found helpful jsfiddle
edit: if want datepicker not disappear @ , read answer
use inline calendar altfield
<input type="text" id="alternate" size="30" /> <div id="datepicker"></div> <script> $("#datepicker").datepicker({ altfield: "#alternate" }); </script>
Comments
Post a Comment