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