Membuat Validasi range data tidak lebih besar Jquery
Other 2021-10-30
[removed][removed]
[removed][removed]
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
[removed][removed]
<form id="download-csv" method="post" action="#" class="date-range nice"></form>
[removed]
$(document).ready(function () {
// Initialize date pickers and form validation:
$('form.date-range #reset-start-date').click(function (e) {
e.preventDefault ? e.preventDefault() : e.returnValue = false; // stop link. returnValue is IE stuff
$('form.date-range #start-date').datepicker('setDate', null); // null means reset
onStartDate(''); // reset min start date
});
$('form.date-range #reset-end-date').click(function (e) {
e.preventDefault ? e.preventDefault() : e.returnValue = false; // stop link. returnValue is IE stuff
$('form.date-range #end-date').datepicker('setDate', null); // null means reset
onEndDate(''); // reset max end date
});
var onStartDate = function (date) {
var minEndDate = (date !== '') ? date : null; // null means no minimum, the default min
$('form.date-range #end-date').datepicker('option', 'minDate', minEndDate);
};
var onEndDate = function (date) {
var maxStartDate = (date !== '') ? date : 0; // 0 means today, the default max
$('form.date-range #start-date').datepicker('option', 'maxDate', maxStartDate);
};
$('form.date-range #start-date').datepicker({
maxDate: 0, // nothing past today
dateFormat: 'yy-mm-dd', // Equiv to ISO-8601 'YYYY-MM-DD' which allows dateISO validation
changeYear: true,
changeMonth: true,
yearRange: '1963:2009',
onClose: onStartDate
});
$('form.date-range #end-date').datepicker({
maxDate: 0, // nothing past today
dateFormat: 'yy-mm-dd', // Equiv to ISO-8601 'YYYY-MM-DD' which allows dateISO validation
changeYear: true,
changeMonth: true,
yearRange: '1963:2009',
onClose: onEndDate
});
$('form.date-range').validate();
});
[removed]
Referensi : http://jsfiddle.net/jd_in_dc/VMqMx/