jquery ui datepicker IE重新加载或跳转到页面顶部 [英] jquery ui datepicker IE reload or jumps to the top of the page
问题描述
我在IE 7 + 8中注意到这个问题
I am noticing this issue in IE 7 + 8
$('#event-start-date').datepicker({dateFormat:'DD MM dd yy',minDate:'-0d'});
当您在IE 7或8中选择日期时,页面将转到#并重新加载根页面
When you pick the date in IE 7 or 8 the page goes to # and reloads the root page
我正在使用jquery 1.4.0和ui 1.7.2
I am using jquery 1.4.0 and ui 1.7.2
推荐答案
我使用IE7经历了与jquery 1.4.2相同的问题。这只会在使用模态对话框时发生。 datepicker出现在页面上,但选择日期会导致您被重定向到#片段。
I've experienced the same issue with jquery 1.4.2 using IE7. This only happens to me when using a modal dialog box. The datepicker appears on the page just fine but selecting a date causes you to be redirected to the # fragment.
我发现一个可行的修复程序,如果不可取的话: a href =http://forum.jquery.com/topic/modal-dialog-with-datepicker =noreferrer> http://forum.jquery.com/topic/modal-dialog-with-datepicker
I found a fix that is workable if not desirable here: http://forum.jquery.com/topic/modal-dialog-with-datepicker
基本上你只需将选项上的href关闭:
Basically you just tear the href off of the box on select:
.datepicker({ onSelect: function() { $(".ui-datepicker a").removeAttr("href"); } });
或者,如果您在动态加载和重新绑定的内容上使用datepicker,您可能会首先丢失课程:
Or, if you are using the datepicker on content that is dynamically loaded and re-binding you may have to lose the class first:
$("#your_text_box_id").removeClass('hasDatepicker').datepicker({ onSelect: function() { $(".ui-datepicker a").removeAttr("href"); } });
由于jquery datepickers和IE的许多其他问题,让我一段时间找到这个,去图。
Took me a while to find this because of the many other issues with jquery datepickers and IE, go figure.
这篇关于jquery ui datepicker IE重新加载或跳转到页面顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!