jQuery UI DatePicker Scrolls to Top After Select

I have been struggling with the jQuery UI DatePicker and almost started using an alternate one. If my grid causes the page to scroll down, and I open a dialog with a DatePicker on it, after I choose the date, the window would scroll to the top. I looked over the code for the DatePicker and nowhere are they setting the scroll position.

After banging my head I noticed that the date selector was simply an anchor tag with href=”#”, which defaults to the top of the document.

In the jQuery UI code I simply replaced all of the href=”#” with javascript: function() { return false };


About Jeremy Mullinax-Hill

I am a lead/senior developer with more than 10 years experience in both the public and internal applications for Fortune 500s and mid-sized View all posts by Jeremy Mullinax-Hill

One response to “jQuery UI DatePicker Scrolls to Top After Select

  • ELias Vicente (@eedv)

    Oh, finally I could fix the scroll up problem with your solution…

    You should post this on the jquery ui bug tracker or something. Because the “official” workaround posted in the ticket for this bug does not work in all cases.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: