Help with Datetangepicker in jQuery

Asked

Viewed 72 times

1

I am using the jQuery Date Range Picker in a form. Follow the code on jsfiddle

My problem is when I cling to input Input the date range Picker appears normally, but when I click on the input date I needed it to close and open in the Output input. As it is I select the input and output date by the input input.

Does anyone know how I can fix this?

  • After selecting the first date, put the datepicker div below the final date input, serves as solution?

  • Note that in the code I passed in jsfiddle when I select a enter the date range Picker is only in the input input. Notice how it works on the https://www.decolar.com/ website was the way I needed it

1 answer

1


I did not delve into the events that the datepicker itself makes available, perhaps I have some more "correct" way of doing this. I simply detect the click on the datepicker, if after the click the initial date is filled in, reposition the datepicker below the input of the final date.

$(".date-picker-wrapper").click(function(){
    if($(this).find(".start-day").html().length > 4){
        $(this).css('left',$("#datasaida").offset().left);
  }
});

Follow a fiddle of the code: jsFiddle

*Note that when resizing the page the starting position is restored, from to treat this with resize()

  • You can open Datepicker by clicking on the output input as well?

  • Open in dataentrada or in the datasaida same? (in the dating is a little more complicated :P)

  • Open in the output only to change the output date. has as?

  • @Newtech I think in this case, we have to do the same thing we did for dataentrada, by clicking on datasaida position the datepicker in the dataentrada, I looked at the doc. I found nothing about starting by selecting the interval from the final date :/ leaves the question open there, maybe someone will come up with another alternative p/ resolve this issue.

  • do not need to start selecting from the final date. only giving to open the date Picker by the date is already good

Browser other questions tagged

You are not signed in. Login or sign up in order to post.