Sistem Informasi Sekolah Terintegrasi

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">
<input id="start-date" type="text" name="startDate" tabindex="1" class="dateISO input-text small required" placeholder="Please select a start date" /> <input id="end-date" type="text" name="endDate" tabindex="2" class="dateISO input-text small required" placeholder="Please select an end date" /> <input type="submit" value="Submit" tabindex="3" class="nice radius large blue button" />
</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/