JQuery Mobile UI DatePicker更改日期格式
我正在尝试更改JQM UI Datepicker中的日期格式。
它有一个输入,显示更改它们的日期。
我需要它以dd / mm / yyyy格式显示。
有人可以帮忙吗?
更新:
我正在尝试这个,但没有任何改变:
//reset type=date inputs to text $( document ).bind( "mobileinit", function(){ $.mobile.page.prototype.options.degradeInputs.date = true; }); $(document).ready(function() { $.datepicker.formatDate('dd/mm/yyyy'); //ADDED HERE $("input[type='submit']").click(function(e) { e.preventDefault(); }); });
试试这个$.datepicker.formatDate('dd/mm/yyyy');
更多参考
更改“jquery.ui.datepicker.mobile.js”文件
添加日期格式:dateFormat:“dd / mm / yy”代码如下所示
//bind to pagecreate to automatically enhance date inputs $( ".ui-page" ).live( "pagecreate", function(){ $( "input[type='date'], input[data-type='date']" ).each(function(){ $(this).after($("").datepicker({ altField: "#" + $(this).attr("id"), showOtherMonths: true, dateFormat: "dd/mm/yy" })); }); });