The date input date selection control for jquery, which is used on some date forms, is a good result.
Official introduction and download Address http://jonathanleighton.com/projects/date-input/
Libraries and CSS files that need to be imported into the jquery library and date input before use
<script type= "Text/javascript" src= "Js/jquery-1.4.4.min.js" ></script>
<script type= "Text/javascript" src= "Js/jquery.date_input.js" ></script>
<link rel= "stylesheet" href= "Css/date_input.css" type= "Text/css" >
The official website downloads the package to contain the JS and the CSS file.
Change the default date format before use, and the following is the Chinese date. Parameter settings are simple, the final datetostring parameter value is the date format returned, here is the year-month-day format. You can change it yourself.
$.extend (dateinput.default_opts, {month_names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] ,
short_month_names: ["A", "two", "three", "four", "five", "six", "seven", "eight", "Nine", "Ten", "11", "12"],
short_day_names: ["Day", "one", "two "," three "," four "," five "," six "],
datetostring:function (date) {
var month = (Date.getmonth () + 1). toString ();//month
var d Om = Date.getdate (). toString ()//day
if (month.length = 1) month = "0" + month;//control month is 101 display 01 format
if (dom.length = = 1 dom = "0" + dom;//same month return
date.getfullyear () + "-" + month + "-" + dom;
}
);
* In the download of the compressed package, there is a translations directory, which has the default language date setting, Jquery.date_input.zh_CN.js is the Chinese date, but his short_day_names parameters are ["One", "two", "three", "four "," Five "," six "," Day "]. Sunday and one showed wrong.
Responding to Inpu component code
$ (function () {$ ("#birthday"). Date_input ();
Birthday is the component ID
<input readonly id= "Birthday" type= "text" name= "Birthday" size= ">