This article mainly introduces the usage of the jQuery calendar plug-in datepicker. If you are interested, you can refer to jQuery as a rare and excellent javascript script development library, many plug-ins based on it are also very standard and excellent. It would be a pity to miss this beautiful view, such as the datepicker plug-in.
In general, the front-end of the MIS system, especially the user registration page, will have a date input box such as "Year of birth". The simplest way is to useTags, which have many drawbacks: first, matching the database field type, and second, the validity of the input date, such as "13 months" or "leap year, if you go deep, there are still many things worth pondering. The drop-down menu is a popular practice.But this is not ideal for interaction, complexity, and portability. Because at least three linked drop-down menus need to be built, you need to write a large number of scripts to process the date validity.
Datepicker brings beautiful spring. Let's see what it looks like when using the default style:
Datepicker is favored by many developers, including the well-known google, this script is used in its google calendar project. If you are interested, you can check it out. By the way, the default effect is that in javascript, users only need to write one sentence to achieve it. How can this problem be solved? follow me:
1. download the jQuery core file. datepicker is a lightweight plug-in. You only need to download the jQuery min version, and then download datepicker (containing jQuery1.2.6 _ min ), you can also download it from the official website: http://marcgrabanski.com/pages/code/jquery-ui-datepicker.
2. reference the two downloaded js files in HTML: