admin管理员组文章数量:1327890
I´m writing an application that deals massively with dates.
So, I´m using the new HTML5 input types for datetime, date, month and week...
Surprisingly I found out this is not working on IE10. I´m using IE version 10.0.9200.
To check this out, please open that page: Test Link
My typical input type looks like (I´m using Tweeter Bootstrap as well):
<div class="col-md-8">
<div class="form-group">
<label for="dateTime">Período do Relatório</label>
<input type="date" class="form-control" id="reportDate">
</div>
<script>
var isoString = toLocalIsoString(new Date());
document.getElementById("reportDate").value = isoString.substr(0, 10);
</script>
</div>
And them later I chage the type I need, like:
document.getElementById('reportDate').type = 'week';
or
document.getElementById('reportDate').type = 'month';
In Chrome it works real nice, opening choose windows for the user to choose the month on week, but in IE I get the following error (translated):
0x80070057 - Javascript execution time error. Invalid argument.
So, according to this scenario:
a) I´m doing something wrong here ?
b) If not, how can I support these HTML5 in IE10.
c) If in fact this will not work in IE10, what are the alternatives to have a Chrome like behaviour (popup a small windows so that the user chooses the month, date, week, etc.).
Thanks in advance for any help.
I´m writing an application that deals massively with dates.
So, I´m using the new HTML5 input types for datetime, date, month and week...
Surprisingly I found out this is not working on IE10. I´m using IE version 10.0.9200.
To check this out, please open that page: Test Link
My typical input type looks like (I´m using Tweeter Bootstrap as well):
<div class="col-md-8">
<div class="form-group">
<label for="dateTime">Período do Relatório</label>
<input type="date" class="form-control" id="reportDate">
</div>
<script>
var isoString = toLocalIsoString(new Date());
document.getElementById("reportDate").value = isoString.substr(0, 10);
</script>
</div>
And them later I chage the type I need, like:
document.getElementById('reportDate').type = 'week';
or
document.getElementById('reportDate').type = 'month';
In Chrome it works real nice, opening choose windows for the user to choose the month on week, but in IE I get the following error (translated):
0x80070057 - Javascript execution time error. Invalid argument.
So, according to this scenario:
a) I´m doing something wrong here ?
b) If not, how can I support these HTML5 in IE10.
c) If in fact this will not work in IE10, what are the alternatives to have a Chrome like behaviour (popup a small windows so that the user chooses the month, date, week, etc.).
Thanks in advance for any help.
Share Improve this question asked Jan 8, 2014 at 1:03 MendesMendes 18.6k38 gold badges166 silver badges282 bronze badges5 Answers
Reset to default 3According to Can I Use the date-time input types are not supported by IE. A good alternative would be jQuery UI.
Perhaps Internet Explorer and Firefox do not support it .Check the link here!
http://www.w3schools./html/html5_form_input_types.asp
https://developer.mozilla/en-US/docs/Web/HTML/Element/Input
For the last link check Browser patibility at the end of the page
According to quirksmode, the HTML5 advanced form tag features such as dates are not supported very widely.
Date inputs are not supported by majority browsers.
Since you already use Bootstrap in your project I would remend to use bootstrap-datepicker javascript plugin.
Had this issue with Angular JS (all cool kids use it). Short term fix is to include a script ref to babel-es6-polyfill in your index.html. Looking at typescript for future implementations.
<script src="node_modules/babel-es6-polyfill/browser-polyfill.min.js"></script>
本文标签: javascriptHTML5 input types not working in IE10Stack Overflow
版权声明:本文标题:javascript - HTML5 input types not working in IE10 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742229674a2436989.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论