jQuery UI datepicker and mobile "wrapper" -
i have tried use mobile "wrapper" jquery ui datepicker based on that page
working code (part of wordress template) looks like:
header:
<link type="text/css" href="/css/custom-theme/jquery-ui-1.8.18.custom.css" rel="stylesheet" /> <script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script>
part of html:
<script> jquery(document).ready(function() { jquery("#datastart").datepicker({ mindate: '+2d', changemonth: true, changeyear: true, dateformat: 'mm/dd/yy', onselect: function(date){ var dates = date.split('/'); var lastdate = new date(dates[2], dates[0], 0); var y = lastdate.getfullyear(), m = lastdate.getmonth(), d = lastdate.getdate(); m = ('0'+ (m+1)).slice(-2); jquery('#dataend').val(m+'/'+d+'/'+y); var start = jquery('#datastart').datepicker('getdate'); jquery('#dataend').datepicker({dateformat: 'mm/dd/yy'}).datepicker('setdate', m+'/'+d+'/'+y); var end = jquery('#dataend').datepicker('getdate'); var days = ((end - start)/1000/60/60/24)+1; jquery('#calculated').text(days); } }); }); </script> <tr> <td width="123" height="25" style="text-align: right;"><label for="datastart">start date:</label> </td> <td align="left" valign="top" class="copy11"><input type="text" style="width: 88px;" class="datepicker" id="datastart" size="10" name="datastart" data-role="date" /></td> </tr> <tr> <td width="123" height="25" style="text-align: right;"><label for="dataend">end date:</label> </td> <td align="left" valign="top" class="copy11"><input type="text" style="width: 88px;" class="end_date" id="dataend" size="10" name="dataend" value="" readonly /></td> </tr>
and when follow example provided link above, have "mobile friendly", datepicker jquery ui api not working not getting "mobile friendly".
i have used jquery ui datepicker monkey patch , works fine "wrapping" regular jquery ui mobile devices.
Comments
Post a Comment