Creating date type text field for android

I am creating an HTML5 application for Android.

I am using jQuery mobile with the following headers:

<link rel="stylesheet" href="../../lib/jquery.mobile-1.3.0.min.css" /> <script src="../../lib/jquery-1.8.2.min.js"></script> <script src="../../lib/jquery.mobile-1.3.0.min.js"></script> 

and I add an input field as described in jQuery mobile demo site :

 <input type="date" data-clear-btn="false" name="date-1" id="date-1" value=""> 

However, instead of datepicker I just get a text box.

Did I miss something?

+4
source share
3 answers

Only certain browsers will display the date picker. This post may be useful for you to determine if it will be or not:

HTML5 type detection and plugin initialization

If the browser does not support datepicker, you can add custom jquery ui datepicker

+3
source

First, only Chrome will show the datapicker component. Other desktop browsers will not work, so do not rely on this implementation.

Secondly, jQuery Mobile does not have a datepicker component. Thus, you will need to use a third-party plugin. Do not rely on jQuery UI datepicker plugins because they are not optimized for use on mobile devices.

It is better to use some of the third-party jQuery plugins for mobile devices:

Datebox

and

Mobiscroll

Here are some of my answers and examples of using jQM datapickers:

How to show datupixer only for field focus?

Datepicker for jQuery mobile (Android)

+5
source

Of course, this is the text box needed to initialize the date picker:

and you need one jquery ui library:

  <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script> $(document).on('pageinit', function(){ $("#date-1").datepicker(); }); 

Try this and see if it helps.

0
source

Source: https://habr.com/ru/post/1469215/


All Articles