DatePicker () and change format for JQuery UI

Source: Internet
Author: User

Continuing the practice of the MVC application, just practiced the DatePicker () method in the jquery UI to allow the user to enter the date quickly in the text box.

The code is concise and simple.

Open a view of the previous exercise views\home\index.cxhtml:
Add an input HTML tag, whose type is text:


Then in the head node of the view, reference jquery UI, how to reference, you can refer to: "MVC program Implementation autocomplete function" http://www.cnblogs.com/insus/p/3546255.html This article describes the UI libraries and styles for installing jquery in an MVC application.



In the relative position of your view, reference and write the above 3 parts code, that is done.
Finally, take a look at the effect of the run:


effect See, its display format is the default format of "Month/day/year", can we change its display format? If you want to change the format, there must be no problem. For a better presentation, you may have to refer to this MVC application and dynamically create a radio list (RadioButtonList) http://www.cnblogs.com/insus/p/3551348.html.
But we have to write some jquery code, which means that when the user taps the Radio Button list option, it can change the date display format of the text box. Two procedures, one is to add the change event for the radio single-selection list, and the other is to add option to the DatePicker () method:



Real-time Operation Demo:

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.