views:

234

answers:

3

I am noticing this issue in IE 7 + 8

$('#event-start-date').datepicker({dateFormat:'DD MM dd yy',minDate:'-0d'});

When you pick the date in IE 7 or 8 the page goes to # and reloads the root page

I am using jquery 1.4.0 and ui 1.7.2

A: 

Did anyone find a solution for this.... it is driving me a little nuts...

As matthewb says in the comments to the question, upgrading to a newer version of jQuery fixes the problem.
Douwe Maan
A: 

I have the same error. I just remove each function step by step from my js-file and found out that it has problems with using the datepicker on dialogs. I removed the dialog and the datepicker works like expected. Then I played a little bit with my dialog-option and found out, that the datepicker doesn't works on dialog with activated modal:true-option. But for now I don't know why it is so?!?!

Stefan Frömken
+1  A: 

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.

I found a fix that is workable if not desirable here: http://forum.jquery.com/topic/modal-dialog-with-datepicker

Basically you just tear the href off of the box on select:

.datepicker({ onSelect: function() { $(".ui-datepicker a").removeAttr("href"); } });

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"); } });

Took me a while to find this because of the many other issues with jquery datepickers and IE, go figure.

Anon
Thanks so much for this! I wish they would add this to the code of jQuery.
Darryl Hein