简体   繁体   中英

why does datepicker fades away?

I am working on project where I am currently on jumping from one date picker to another when proper date is selected. I have been able to make the jump successful. However, the focus towards the second datepicker fades away in a very short period of time. Here is my code:

<html>
<input id="datepickerOne" placeholder="date picker one">
 <input id="datepickerTwo" placeholder="date picker one">
</html>
<script>
$('#datepickerTwo').datepicker()
$('#datepickerOne').datepicker({
    onSelect: function(){
      $("#datepickerTwo").focus()
    }
  })
</script>

Can anyone come up with a solution to make "#datepickerTwo" appear as long as date is selected?

Change your onSelect function to this:

$('#datepickerOne').datepicker({
    onSelect: function(e){
      $("#datepickerTwo").focus();
      e.preventDefault();
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM