jQueryUI DatePicker Component Set Date highlighting _jquery

Source: Internet
Author: User

When looking at the jQueryUI DatePicker component recently, we thought that sometimes we need to highlight certain dates, not just the current date and the selected date, but we need to set some dates to highlight when the calendar component is initialized to indicate that these dates are different from other dates. For example, you can say that these dates have meeting or task. This requirement can be achieved by using the component's Beforeshowday (date) function, which can be used to perform custom functions when the DatePicker component is initialized, calling this function once every day, so that the desired requirements are met.

Let's see how to achieve

First download the jquery-ui-1.11.1 package and unzip it.

Then create a calenar.html file in the jquery-ui-1.11.1 directory to test.

The contents of calenar.html are as follows:

<!doctype html>  

Where the Beforeshowday function defines three dates that need to be highlighted, and when the initialization date equals one of the dates, set the date to be highlighted, otherwise the default value is returned.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.