twitter bootstrap - Keep jQuery datetimepicker open -
let me share exact scenario. have 2 inputs
<input type="text" id="dt1" readonly="readonly" /> <input type="text" id="dt2" readonly="readonly" />
i have set datepicker below
$("#dt1").datepicker({ showon: "button", buttonimage: "../images/calender.gif", buttonimageonly: true, changemonth: true, changeyear: true, onselect: function (datetext, inst) { $("#dt2").datepicker("show"); } }); $("#dt2").datepicker({ showon: "button", buttonimage: "../images/calender.gif", buttonimageonly: true, changemonth: true, changeyear: true, onselect: function (datetext, inst) { $("#dt1").datepicker("show"); } });
now doing is, on selection of 1 datepicker opening datepicker.
and while checking markup through firebug, found there 1 datepicker div
which handled both of datepicker.
so clicking on imagebutton set div's display:block;
, focus lost there set div's display:none;
so issue was, while on selection of 1 datepicker show datepicker, after onclose event of first datepicker called set datepicker div's display:none
. second datepicker not visible.
as solution,
i open 2nd datepicker onclose
of 1st datepicker instead of onselect
.
$("#dt1").datepicker({ showon: "button", buttonimage: "../images/calender.gif", buttonimageonly: true, changemonth: true, changeyear: true, onselect: function (datetext, inst) { }, onclose: function (datetext) { $('#dt2').focus(); } });
now working fine me.
Comments
Post a Comment