bootstrap-date_picker结合响应的html5类型日期用于iphone视图

bootstrap-date_picker conjunction responsive html5 type date for iphone view

本文关键字:日期 类型 用于 iphone 视图 html5 picker 结合 响应 bootstrap-date      更新时间:2023-09-26

我使用bootstrap-2.3.2和bootstrap-date_picker构建了一个对iphone友好的视图bootstrap-datepicker运行良好,除非视图在iphone上呈现。我想让standart html5标签type='date'对于@media没有日期选择器行为(最大宽度:767px)

我想知道如何实施这种行为。

我的观点:

<input class="string date_picker optional" data-date-autoclose="true" data-date-format="dd.mm.yyyy" data-date-language="ru" id="ride_trip_date" name="ride[trip][date]" type="text">

我的js:

$("input.date_picker").datepicker()

我不能用.visible phone生成第二个分部,因为这个输入是我的模型的嵌套属性数组

使用window.matchMedia():

if (window.matchMedia("(min-width: 768px)").matches) {
  $("input.date_picker").datepicker();
}