JQuery UI simple fix, hard error to find – TypeError: a is undefined

This is my first development blog. I intend to do this much more often on all the little problems I come across, so hopefully I will improve.

This happens for one of two reasons:
1. Multiple Ids on the same page with the same id.
2. (one that applied to me)Adding the “hasdatepicker” class to the DOM object before calling .datepicker

I was porting an existing implementation and I copied the css classes as I saw them on the DOM not realizing that JQueryUI uses that class as a marker. If it sees that class, it assumes that the datepicker has already been setup.

Searching the web, I found an answer to number one, but I could not find reason #2 anywhere. Hopefully this will help someone who makes the same silly mistake I did.

This entry was posted in Development and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *