IE 输入类型日期未显示为日期选择器
IE Input type Date not appearing as Date Picker
我在 HTML 中使用输入类型 DATE,在 Chrome 和 Firefox 中一切正常,但 IE 不显示日期选择器。
当我使用 JQuery 日期选择器时,我在 Chrome 和 Firefox 中得到两个日期选择器对话框。
如何修复可以使用日期输入类型但表单只有一个弹出窗口的功能?
您需要使用 polyfill so that the input type DATE has a consistent behaviour in all browsers. You can use this webshim 作为 polyfill。
输入类型 DATE 是一项 HTML5 功能,并非所有浏览器都支持该功能。如果你想使用你的浏览器(通常是 IE)不支持的 HTML5 功能,那么使用两个东西:
- 特征检测
- 填充
功能检测是确定我们的浏览器是否支持 HTML5 功能的能力。 Modernizr. What you can do with modernizr is to detect if any feature that you need is not supported and if not then you can conditionally load some javascript libraries that will implement that feature. Those libraries are called Polyfills.
是一个很好的图书馆
例如,如果您想在 IE 10 中使用标签,您可以使用 jqueryui.com 控件来提供日期选择器。
Modernizr.load({
test: Modernizr.inputtypes.date,
nope: "js/jquery-ui.custom.js",
callback: function() {
$("input[type=date]").datepicker();
}
});
Modernizr 测试该功能是否受支持,您可以选择使用 nope 来指示是否有您想要仅在不支持该功能时加载的库,回调是将在该功能之后调用的代码测试并加载库后。
我在 HTML 中使用输入类型 DATE,在 Chrome 和 Firefox 中一切正常,但 IE 不显示日期选择器。
当我使用 JQuery 日期选择器时,我在 Chrome 和 Firefox 中得到两个日期选择器对话框。
如何修复可以使用日期输入类型但表单只有一个弹出窗口的功能?
您需要使用 polyfill so that the input type DATE has a consistent behaviour in all browsers. You can use this webshim 作为 polyfill。
输入类型 DATE 是一项 HTML5 功能,并非所有浏览器都支持该功能。如果你想使用你的浏览器(通常是 IE)不支持的 HTML5 功能,那么使用两个东西:
- 特征检测
- 填充
功能检测是确定我们的浏览器是否支持 HTML5 功能的能力。 Modernizr. What you can do with modernizr is to detect if any feature that you need is not supported and if not then you can conditionally load some javascript libraries that will implement that feature. Those libraries are called Polyfills.
是一个很好的图书馆例如,如果您想在 IE 10 中使用标签,您可以使用 jqueryui.com 控件来提供日期选择器。
Modernizr.load({
test: Modernizr.inputtypes.date,
nope: "js/jquery-ui.custom.js",
callback: function() {
$("input[type=date]").datepicker();
}
});
Modernizr 测试该功能是否受支持,您可以选择使用 nope 来指示是否有您想要仅在不支持该功能时加载的库,回调是将在该功能之后调用的代码测试并加载库后。