I using Multidatepicker MDP from here.
I want to get the total days that selected by user, and place it into input text.
For example if the user select 2 days, then the total is 2.
And the total put in a input type text.
Here is my JS
$('#mdp-demo').multiDatesPicker({
numberOfMonths: [1,2],
altField: '#altField',
minDate: 2,
});
Thank you for your answers
Using the information from the site you linked: http://dubrox.github.io/Multiple-Dates-Picker-for-jQuery-UI/#demo-ui-calendar-methods
You can specify the
onSelectmethod to respond to selections.To get an array of selected dates you can use
$('#mdp-demo').multiDatesPicker('getDates')as documented.If you only care for the number of selected dates you can simply use the
.lengthof the array.I never worked with this component before but parsing together the info from the documentation the below seems to work. Adjust as needed.