jquery Date Selection DatePicker Plug-in usage example analysis _jquery

Source: Internet
Author: User

This example describes the jquery date selection DatePicker plug-in usage. Share to everyone for your reference. Specifically as follows:

1, first of jquery in the DatePicker plug-ins in the relevant attribute values to Chinese:

$.datepicker.regional[' ZH-CN '] = {cleartext: ' Clear ', Clearstatus: ' Purge selected date ', Closetext: ' Close ', Closestatus: ' Do not change Current selection ', Prevtext: ' < last month ', Prevstatus: ' Show last month ', Prevbigtext: ' << ', Prevbigstatus: ' Show last year ', Nexttext: ' Next month > ', Nextstatus: ' Show next month ', Nextbigtext: ' >> ', Nextbigstatus: ' Show next year ', Currenttext: ' Today ', Currentsta Tus: ' Show this month ', monthnames: [' January ', ' February ', ' March ', ' April ', ' May ', ' June ', ' July ', ' August ', ' September ', ' October ', ' November ', ' December ', monthnamesshort: [' One ', ' two ' , ' three ', ' four ', ' five ', ' six ', ' seven ', ' eight ', ' nine ', ' ten ', ' 11 ', ' 12 ', Monthstatus: ' Select Month ', Yearstatus: ' Select Year ', Weekheader: ' Zhou ', weekst ATUs: ' Every week of the year ', DayNames: [' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday '], daynamesshort: [' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday, ', ' Thursday ', ' Friday ', ' Saturday '], daynamesmin: [' Day ', ' one ', ' two ', ' three ', ' four ', ' five ', ' six '], Daystatus: ' Set DD to start of Week ', Datestatus: ' Select M-month D-Day, DD ', Datef
Ormat: ' Yy-mm-dd ', firstday:1, initstatus: ' Please select Date ', Isrtl:false}; 

 $.datepicker.setdefaults ($.datepicker.regional[' ZH-CN '));

2, the HTML page has two date input boxes, respectively, the start date and end Date:

<label for= "Start-datepicker" > Start date:</label> <input type= "text" class= "DatePicker Test-image-datepicker "id=" Start-datepicker "size="/> <label for=
"End-datepicker" > End Date: </label > <input type= "text" class= "DatePicker test-image-datepicker" id= "End-datepicker" size= "/>"

3, invoke the modified DatePicker plug-ins:

 var $start _date_value = "January 1, 2012";//TODO changed to configurable var $end _date_value = new Date (); When document has loaded, initialize pagination and form $ (document). Ready (function () {$ (". Imagezz"). Click ($test _image
 _check_box_click); $ (". Test-image-datepicker"). DatePicker ({changemonth:true, changeyear:true, Showon: "Both", Buttonimage: "images/c Alendar.gif ", Buttonimageonly:true, Showbuttonpanel:true, Onselect:function (Datetext, inst) {if ($ (this). attr (" id
   = = = "Start-datepicker") {$start _date_value = Datetext;
   } if ($ (this). attr ("id") = = "End-datepicker") {$end _date_value = Datetext;
//Below you can write some of the changes in the page related to the date of the function//...}
});
$ (". Test-image-datepicker"). DatePicker ("option", "DateFormat", "yy year mm month DD Day");
$ ('. Test-image-datepicker '). attr ("ReadOnly", "ReadOnly");
$ ("#start-datepicker"). DatePicker ("Setdate", $start _date_value); 
$ ("#end-datepicker"). DatePicker ("Setdate", $end _date_value); 

DatePicker the remaining options and methods are detailed in the following: http://api.jqueryui.com/datepicker/

I hope this article will help you with your jquery programming.

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.