How To Show Datepicker On Field Focus Only?
Solution 1:
Unfortunately currently it can't be done unless you are willing to implement it yourself. jQuery Mobile datepicker was never intended to be officially released as a widget (maybe some day but it was never officially announced). Available code is nothing more then a wrapper around jQuery UI datepicker.
You can check it by yourself, here's an code snipet that shows a datepicker on pagecreate event:
$( ".ui-page" ).live( "pagecreate", function(){
$( "input[type='date'], input:jqmData(type='date')" ).each(function(){
$(this).after( $( "<div />" ).datepicker({ altField: "#" + $(this).attr( "id" ), showOtherMonths: true }) );
});
});
You can change it yourself but whats the point. In case you don't have time for custom implementation take a look at these 3rd party jQuery Mobile date pickers:
First one is Mobi Pick: http://mobipick.sustainablepace.net/demo.html. Simple, easy and robust. Just the one you need. My favorite.
Probably best one is : http://mobiscroll.com/. It used to be my favorite (still is if I need good UI). Mostly because it is robust with an excellent UI.
Also an excellent one is Datebox: http://dev.jtsage.com/jQM-DateBox2/. Also robust but little buggy.
Also take a look at my other similar article: https://stackoverflow.com/a/13779992/1848600
Post a Comment for "How To Show Datepicker On Field Focus Only?"