javascript - Why datepicker show same month when change month on a first time on autoOpening second datepicker -


  1. click on first field;
  2. select day; (then automatic opening second datepicker)
  3. click next month button
  4. showing datepicker has flash, month not change
  5. after this, next month button (and prev month button) have work.

whyyyyyyy ?????

fiddel demo

$(".from_date").datepicker({     mindate: 'd',     dateformat: "dd/mm/yy",     defaultdate: "+1w",     numberofmonths: 2,     onclose: function(selecteddate) {         $(".to_date").datepicker("option", "mindate", selecteddate);         $(this).parents('.span2').next().children().find('.to_date').focus();     } });  $(".to_date").datepicker({     mindate: '+1d',     dateformat: "dd/mm/yy",     defaultdate: "+1w",     numberofmonths: 2 }); 

i can confirm bug, has opening second datepicker onclose function, adding 0 delay timeout seems work though:

onclose: function(selecteddate) {           var $todate = $(this).closest('.span2').next().find('.to_date');           $todate.datepicker("option", "mindate", selecteddate);           settimeout(function(){$todate.datepicker('show')},0);       } 

updated fiddle

note: changed code bit, optimized .to_date selector , made corresponding input updated selected date


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -