i did see a couple of similar threads, but later they turned out to be different issues...mine seems a browser specific problem surely because my datepicker works fine in Firefox, but certainly not in IE8. Here is my original problem and the source code

我确实看到了几个类似的线程,但后来他们发现是不同的问题...我的似乎是浏览器特定的问题,因为我的日期选择器在Firefox中工作正常,但肯定不在IE8中。这是我原来的问题和源代码

I updated my datepicker to jQuery UI Datepicker 1.8.11...still it just doesn't work in IE 8! The date-picker pops up just fine, but no event fires from it. I mean no click...nothing happens...

我将我的datepicker更新为jQuery UI Datepicker 1.8.11 ...但它仍然无法在IE 8中运行!弹出日期选择器就好了,但没有事件发生。我是说没有点击......没有任何反应......

Any ideas?

有任何想法吗?

6 个解决方案

#1


3

Hey I don't know if you have solved that problem yet, however the problem is with any added attributes. Especially if you are using:

嘿我不知道你是否已经解决了这个问题,但问题是任何附加的属性。特别是如果你使用:

yearRange: '-100:+10'

for example ...

例如 ...

This is how you resolve the issue: copied from http://satish.name/?p=19

这是您解决问题的方法:从http://satish.name/?p=19复制

jQuery datepicker adds a new attribute to the DOM element in IE. if you try to add a new DOM element dynamically copying from an existing element the datepicker will not work in IE as the newly added DOM element refers to the old jQuery attribute. One way to fix this is to delete the attribute and then instantiate the datepicker class on the element. See the following code for the fix.

jQuery datepicker在IE中为DOM元素添加了一个新属性。如果您尝试从现有元素动态复制添加新DOM元素,则datepicker将无法在IE中工作,因为新添加的DOM元素引用旧的jQuery属性。解决此问题的一种方法是删除属性,然后在元素上实例化datepicker类。请参阅以下代码以获取此修复程序。

//newDiv is the new added dom element with innerHTML
jQuery("#newDiv").find(".datePicker").each(function() {
    //removing jquery added attribute as this is causing the dynamically
    // added DOM elem referring old DOM element from it is copied.
    if (jQuery.browser.msie) {
        var jqaddedattr;
        jQuery(this.attributes).each(function() {
            if (this.name.search(/jQuery/) != -1) {
                jqaddedattr = this;
            }
        });
        if (jqaddedattr) {
            jQuery(this).removeAttr(jqaddedattr.name);
        }
    }
    jQuery(this).datepicker({yearRange: '-100:+10', changeFirstDay:false}).val("").trigger('change');
})

cheers

干杯

更多相关文章

  1. Yii - 加载ajax表单元素的用户端验证
  2. jsf中获取属性值的普通获取和jquery获取区别
  3. 删除后重新插入后保留对元素的引用
  4. bootstrap-select js jQuery控制select属性变化
  5. jquery中获取相邻元素相关的命令:next()、prev()和siblings()
  6. JQUERY组装对象并调用自身函数改变自己的属性
  7. 如何选择两个h2之间的所有元素
  8. 千呼万唤 HTML 5 (2) - 区块元素
  9. 在中的元素的自定义子弹符号,这是一个普通字符,而不是一个图像

随机推荐

  1. php 缓存output_buffering和ob_start
  2. php执行数据库查询返回json格式数据
  3. 【ecmall】解决无法上传店铺logo和banner
  4. 一个棘手的问题:JS中何如嵌入PHP程序???
  5. 【转】2012年6月26 – 盛大PHP工程师最新
  6. Laravel在模型保存中两次插入差异
  7. thinkphp环境变量.env配置
  8. 关于php5.*后的时区问题 date_default_ti
  9. 使用没有实体类的本机SQL查询
  10. 如果作者是Post的作者那么做点什么?