我在jquery对话框中实现了datepicker,当我点击外部对话框时,日历消失,当我点击我的datepicker文本框时,它不会显示回来。这引起了我的问题,因为我希望日历在文本框中单击后立即显示。以下是我的一段代码。一小时内的任何帮助都会受到很多赞赏。
日期选择器:
//applying datepicker for renew job popup.
//added by hkaur5
$(function(){
//Applying datepicker-------------
$("input#job_expiry_date").datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
maxDate: '1M',
minDate: '0',
onSelect: function( selectedDate ) {
$("#date_to").datepicker( "option", "minDate", selectedDate );
}
//showButtonPanel: true,
});
});
对话框:
//Alert box for changing expiry date of job (renew).
$( "div#renew_job_dialog_box" ).dialog({
modal: true,
autoOpen: false,
draggable:false,
width: 261,
height:300,
show: {
effect: "fade"
},
close:function() {
$( this ).dialog( "close" );
//Setting drop down previous value.
$( $(this).data('renew_select_box') ).val( $.data( $(this).data('renew_select_box'), 'current' ) );
},
hide: {
effect: "fade"
},
buttons: {
OK: function() {
$( this ).dialog( "close" );
renewJobExpiryDate( $( $(this).data('renew_select_box') ).attr("id"),$('input#job_expiry_date').val(), $( $(this).data('renew_select_box') ));
},
Cancel: function() {
$( this ).dialog( "close" );
//Setting drop down previous value.
$( $(this).data('renew_select_box') ).val( $.data( $(this).data('renew_select_box'), 'current' ) );
}
}
});
HTML:
<div id="renew_job_dialog_box" title="Renew Job" style = "display:none;height:300px">
<p>
<input id="job_expiry_date" class="job_expiry_date" type="text" readonly="" style="width:79%; margin-left:11px;" name="job_expiry_date">
</p>
</div>