[英]JQuery DatePicker for input type=date IE11 Error: Object doesn't support property or method swap
I am using the html5 tag:我正在使用 html5 标签:
<input type="date" name="date" id="date">
this works on phones en microsoft edge browser but not on internet explorer.这适用于手机和微软边缘浏览器,但不适用于 Internet Explorer。 to get it to work on IE11, I added the following:
为了让它在 IE11 上工作,我添加了以下内容:
<script src="//cdn.jsdelivr.net/webshim/1.14.5/polyfiller.js"></script>
<script>
webshims.setOptions('forms-ext', {types: 'date'});
webshims.polyfill('forms forms-ext');
</script>
When I click on the calendar in IE11, I get the following error: Object doesn't support property or method swap.当我在 IE11 中单击日历时,出现以下错误:对象不支持属性或方法交换。
I am using the following JQuery sources:我正在使用以下 JQuery 源:
<script src="https://code.jquery.com/jquery-2.2.2.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
This appears to be a bug in webshim.这似乎是 webshim 中的一个错误。 https://github.com/aFarkas/webshim/issues/560 states two possible workarounds
https://github.com/aFarkas/webshim/issues/560陈述了两种可能的解决方法
jquery-swap.js: jquery-swap.js:
jQuery.swap = function( elem, options, callback, args ) {
var ret, name, old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
index.html索引.html
<script src="https://code.jquery.com/jquery-2.2.2.js"></script>
<script src="js/jquery-swap.js"></script>
It would be nice if the dependencies were clearly stated.如果明确说明依赖关系就好了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.