Jquery-ui use of date plug-in

Source: Internet
Author: User
Tags time and seconds

HTML for

        <type= "text"  ID= "StartTime"/>        <  type= "text"  ID= "Endtime"/>

Set the ReadOnly property, the input box is not writable;

Introduction of necessary JS files and CSS files

        <Linkrel= "stylesheet"type= "Text/css"href= "Jquery-ui.css" />        <Scripttype= "Text/javascript"src= "Jquery-1.11.2.min.js"></Script>        <Scripttype= "Text/javascript"src= "Jquery-ui.js"></Script>

If you want to use Chinese, the following JS file should be introduced

        <type= "Text/javascript"  src= "Datepicker_cn.js " ></ Script >

You also need to initialize the plugin after the page is loaded

1$(function(){2                 /*3 * Initialize Date plugin4                  */5$ (' #starttime '). DatePicker ({6OnSelect:function(Datetext, inst) {7$ ("#endtime"). DatePicker ("option", "MinDate"), datetext);8                     },9Showbuttonpanel:true,TenInline:true One                 }); A                  -$ (' #endtime '). DatePicker ({ -OnSelect:function(Datetext, inst) { the$ ("#starttime"). DatePicker ("option", "MaxDate"), datetext); -                     }, -Showbuttonpanel:true, -Inline:true +                 }); -});

To limit the start time must start today, not optional yesterday, after the initialization of the above can continue to add a sentence

1     // limit start time minimum to today 2     $ (' #txtbegintime '). DatePicker (' option ', ' mindate ', ' 0 ');

If you only want to use the time and seconds plugin, you need to introduce the following JS file and CSS File

       <Linkrel= "stylesheet"type= "Text/css"href= "Jquery-ui.css" />        <Scripttype= "Text/javascript"src= "Jquery-1.11.2.min.js"></Script>        <Scripttype= "Text/javascript"src= "Jquery-ui.js"></Script>        <Scripttype= "Text/javascript"src= "Jquery-ui-timepicker-addon.js"></Script>        <Scripttype= "Text/javascript"src= "Jquery-ui-timepicker-zh-cn.js"></Script>//Chinese
1 $ (function() {2     $ ("#starttime"). Timepicker (); 3     $ (". Timeinput"). Timepicker (); 4 });
Initialization

Not finished, continue to add ...

Jquery-ui use of date plug-in

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.