JQuery: 1 datepicker From date to constrain the To date
<p>The user has to enter a Date From field and a Date To field.
The Date To field must be after Date From.
How do I enforce this in JQuery?
My current code does not work, not even by giving a default date.</p>

<pre><code>&lt;script type="text/javascript" language="javascript"&gt;
    $('#DateFrom').datepicker({ dateFormat: 'dd-MM-yy', changeMonth: true, changeYear:true, yearRange: 'c-1:c+1' });
    $('#DateTo').datepicker({ dateFormat: 'dd-MM-yy', changeMonth: true, changeYear: true, yearRange: 'c-1:c+1' });
    $('#DateFrom').datepicker({ onSelect: function (dateStr) {
        $('#DateTo').datepicker({ defaultDate: dateStr });
    }
    });
    $('#DateTo').datepicker();

&lt;/script&gt;
</code></pre>
