Reputation: 47
I am new to HTML5. I want to select start and end dates in my textbox which is input type date. start date must disable future dates and end date should enable greater than start date.
Upvotes: 2
Views: 15360
Reputation: 6150
We can set value of the start date to min attribute of the end date.
start.addEventListener('change', function() {
if (start.value) end.min = start.value;
}, false);
Upvotes: 4
Reputation:
I would recommend using JQuery for date validation. JQuery is a JavaScript library, here is a good date range picker for you to get started.
http://jqueryui.com/datepicker/#date-range
Upvotes: 0
Reputation: 1455
You could use the Parsley JS plugin for this. I've used it in several projects and it's great for setting up quick & precise validation.
Upvotes: 0