问题
I my application i use jt.sage DateBox. I want to disable the already selected datepicker for next date box fields for example my Date1 is like 13.08.14 my other date box fields need to select after 13.08.14 (NOTE : depends on previous date fields).
Here is the FIDDLE FOR date box demo.
It has lot of options like prevent tomorrow and yesterday day but not include after select the current date
<label for="mydate">Date 1</label>
<input id="date1" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
<label for="mydate">Date 2</label>
<input id="date2" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
<label for="mydate">Date 3</label>
<input id="date3" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
<label for="mydate">Date 4</label>
<input id="date4" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
<label for="mydate">Date 5</label>
<input id="date5" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
How to do this please help to solve this one.
回答1:
Hope this helps you : http://jsfiddle.net/QTuma/52/
Just change in the logic for difference calculation:
Start Date
// Get the difference
var diff = parseInt((((startDate.getTime() - todaysDate.getTime()) / lengthOfDay)+2)*-1,10);
And End Date
// Get the difference
var diff = parseInt((((endDate.getTime() - todaysDate.getTime()) / lengthOfDay)),10);
This will work for the statement 'example my start date is like 13.08.14 my end date box fields need to select after 13.08.14 .'
回答2:
I have updated your code based on below reference,
http://jsfiddle.net/ktbcP/528/
This should solve your issue,
http://dev.jtsage.com/jQM-DateBox/doc/6-2-link/
Hope it helps !!
来源:https://stackoverflow.com/questions/25280308/how-to-disable-the-already-selected-date-for-next-date-box-in-j-t-sage-datebox