Use DatePicker in jquery to limit the start date to less than the end date action

Source: Internet
Author: User

jquery itself provides the functionality of the calendar operation, but has been working with the My97datepicker calendar, each use of the Import folder and the library provided, looked bored, the two days pondering the

JQ of the Calendar control operation, compared to the previous use, the code is more than write a point, but after all, is JQ itself, will not appear some unexpected problems, the following is the code display, I belong to rookie class, write bad, to you heroes more pointing criticism

This is the start date operation

$ ("#endTime"). DatePicker ({

Here write the custom parameter operations such as Showothermonths:true, Selectothermonths:true,

Onselect:function (Datetext, inst) {

$ ("#begTime"). DatePicker ("option", "MaxDate", New Date (Datetext.replace ("-", ",")));//This is the default date, as in 12/2/2011
$ ("#begTime"). DatePicker ("option", "MaxDate", New Date (Datetext.replace ("-", "-")));//Here is the date format changed, 2011-12-2
}

});

This is the end date action

$ ("#begTime"). DatePicker ({
Onselect:function (Datetext, inst) {
$ ("#endTime"). DatePicker ("option", "MinDate", New Date (Datetext.replace ("-", "-"));
}
});

Click the OK button to appear in the modal dialog box, select Start Date and end date

<input id= "Button1" type= "button" value= "OK"/>
<div id= "putdate" title= "Enter Date" >
<span> Please enter a start date:</span>
<input type= "text" id= "Begtime" class= "ui-widget-content ui-corner-all"/>
<span> Please enter the end date:</span>
<input type= "text" id= "EndTime" class= "ui-widget-content ui-corner-all"/>
</div>

The above is the implementation of the functional part of the code, the function is completed, but there is not satisfactory, looking for a half-day, did not find the pop-up Calendar box Empty button, in short, the operation is not as convenient as before

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.