Datepicker for Bootstrap on mobile devices changing Format -
i'm using following datepicker: (http://eternicode.github.io/bootstrap-datepicker/) date-field.
<input class="datepicker" style="width:100px;border-radius: 4px;" type="text" placeholder="datum" id="startdate"....
i'm using 2 diffrent formats 'dd.mm.yyyy' , 'mm/dd/yyyy' , everthing fine. on mobile devices keyboard opens when tap in input-field.
because of used native datepicker <input type='date'....
1 not support different formats.
is there anyway disable keyboard on input type=text
element?
or know other datepicker different formats?
thx help
check exmaple have readonly not grey input default of bootstrap.
i have same fix project.
$(function() { var ismobile = navigator.useragent.match(/(ipad)|(iphone)|(ipod)|(android)|(webos)/i); if (ismobile) { $("#datepicker input").addclass('no-grey').prop('readonly', true); } $("#datepicker").datepicker({ autoclose: true, todayhighlight: true }).datepicker('update', new date());; });
.no-grey { background: #fff !important; }
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" /> <link href="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css" rel="stylesheet" /> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script> <label>select date:</label> <div id="datepicker" class="input-group date" data-date-format="mm-dd-yyyy"> <input class="form-control" type="text" /> <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span> </div>
Comments
Post a Comment