0

「StartDate」と「EndDate」を選択するための2 つの JQuery 日付ピッカーがあります。私の要件は、startDate が選択された後に終了日カレンダーを自動的にポップアップすることです。

COMMENTED HERE のすべての手順を試しました。

このコードは、「EndDate」カレンダーのフォーカスを正常にトリガーしますが、1 秒間表示されて非表示になります。

$(document).ready(function() {  //Runs when tab is loaded
        var dateFormat = "dd/mm/yy";
        var today=new Date();
        today.setMonth(today.getMonth()-1); 
        $("#ctl00_ContentPlaceHolder1_datepicker1").datepicker({
         minDate: 0, 
         dateFormat:dateFormat,
         //maxDate: '+12M +31D',  
         onSelect: function(dateText, inst){
                   var the_date = new Date($.datepicker.parseDate(dateFormat,dateText));
                   //var end=(the_date.getDate()+1) + '/' + (the_date.getMonth()+1) + '/' + the_date.getFullYear();
                   $("#ctl00_ContentPlaceHolder1_datepicker2").datepicker('option', 'minDate', the_date);
                  // TRIED ALL THESE
                  //document.getElementById('ui-datepicker-div').style.display  = 'block';
                  //document.getElementById('ui-datepicker-div').style.left  = '635.5px';
                  //$("#ctl00_ContentPlaceHolder1_datepicker2").datepicker("show");
                  //$("#ctl00_ContentPlaceHolder1_datepicker2").datepicker(); 
                  //$("#ctl00_ContentPlaceHolder1_datepicker2").focus();
                  //$('#foo').slideUp(300).delay(800).fadeIn(400);
                  //$("#ctl00_ContentPlaceHolder1_datepicker2").trigger("focus"); 
                  $('#ctl00_ContentPlaceHolder1_datepicker2').focus();

      }
     });
     $("#ctl00_ContentPlaceHolder1_datepicker2").datepicker({
        //maxDate: '+12M +31D', 
        dateFormat:dateFormat,
        onSelect: function(dateText, inst){

        }                       
    });

 });

WEBSITE こちらがフロントエンドhttp://www.chuttitime.com/beta/

4

2 に答える 2

2

これを使って :

onClose: function() {
                  $('#endDate').focus();
            }});
于 2012-10-18T05:10:14.997 に答える
0

これは便利かもしれません..範囲を示す2つのフィールドがありますhttp://jqueryui.com/datepicker/#date-range

于 2012-10-18T05:10:56.430 に答える