The date input dates component of jquery uses

Source: Internet
Author: User
Tags jquery library


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= ">

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.