Date-time picker for mobile apps

Source: Internet
Author: User

This is a date and time picker for mobile device Web applications, in the desktop version of the date picker we generally use the jquery UI of the DatePicker plugin, and the mobile phone version of the date picker can be selected according to the project needs and jquery Mobile with the Mobiscroll.js plugin, it provides a friendly date and time selection interface, and is easy to configure and use.

View Demo Download Source html

First we load the relevant plug-ins and style files, which are based on jquery and jquery.mobile so we first need to load the two library files before loading the Mobiscroll.js plugin and the associated CSS file.

<scriptSrc="Js/jquery.min.js"></script>
<scriptsrc= "js/jquery.mobile-1.3.0.min.js" ></SCRIPT>&NBSP;
< Script src= "js/mobiscroll.js"  type= "Text/javascript" ></SCRIPT>&NBSP;
<link href= "css/mobiscroll.custom-2.5.0.min.css"  rel= "stylesheet"   Type= "text/css"  />&NBSP;

Then put the input box in the body, this is a normal text input box, when the mouse click on the input box to get the cursor will trigger the Mobiscroll pop-up date picker.

<input id="date" name="date" /> 
Javascript

Mobiscroll provides a number of options that can be set, including the ability to define pop-up panel presentation, maximum date, minimum date, date format, end year, etc., or localize the plugin, including setting the Chinese button, description. The invocation is also very simple, the following is the sample code:

$(function (){
var opt ={
Preset' Date ',Date
Theme' Sense-ui ',Skin Style
Display' Modal ',Display mode
Mode' Scroller ',Date selection mode
DateFormat:' Yy-mm-dd ',Date format
SetText:' OK ',Confirm Button Name
Canceltext:' Cancel ',Cancel button name me
DateOrder:' YYMMDD ', //panel in date arrangement format
Daytext: ' Day ', Monthtext: ' month ', Yeartext: ' year ', //panel in month and day text
Hourtext: ' time ', Minutetext: "Min", Ampmtext:"morning/Afternoon",
Endyear:2020 //End Year
};
$ ("#date"). Mobiscroll (). Date (opt);
});

If only time is selected, you can write this:

$("#time").mobiscroll().time(opt); 

If you want to display the date and time on the panel, this is called:

$("#datetime").mobiscroll().datetime(opt); 

For more information about the Mobiscroll plugin, please refer to its website: http://docs.mobiscroll.com/2-17-0/datetime

Original link: http://www.helloweba.com/view-blog-333.html

Date-time picker for mobile apps

Related Article

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.