问题描述
< div class =form-group>
< label for =start_date>开始日期< / label>
< input type =dateclass =form-controlname =start_dateid =start_dateplaceholder =mm / dd / yyyy>
< / div>
如果我用chrome点击它,会弹出一个日期选择器:
然而,如果我在firefox中点击它,datepicker不会弹出
注意 - 我正在使用bootstrap 3
在此先感谢!!
不幸的是,在Firefox中不支持< input type =date/>
为了能够在所有浏览器中使用日期类型,可以使用modernizer进行检查,如果不支持,可以使用javascript来显示日期选择器。
<脚本>
$(function(){
if(!Modernizr.inputtypes.date){
$('input [type = date]')。datepicker({
dateFormat:' yy-mm-dd'
}
);
}
});
< / script>
I have the following date input:
<div class="form-group">
<label for="start_date">Start Date</label>
<input type="date" class="form-control" name="start_date" id="start_date" placeholder="mm/dd/yyyy">
</div>
If I click on it in chrome, a date picker pops up:
However, if I click it in firefox, the datepicker does not pop up:
Does anyone know why this is happening and/or how I can fix it in firefox so it is consistent?
Note - I am using bootstrap 3
Thanks in advance!!
Unfortunately <input type="date"/>
is not supported in firefox. To be able to use date type in all browser you can check using modernizer and if not supported you can fall back to use javascript to show the datepickerr.
<script>
$(function(){
if (!Modernizr.inputtypes.date) {
$('input[type=date]').datepicker({
dateFormat : 'yy-mm-dd'
}
);
}
});
</script>
这篇关于日期输入不工作在Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!