I’ve got a form that gets shown via a simplemodal popup and one of the form elements is a jquery ui datepicker. If you open the form, choose a date, close the modal, then open the form again and try and choose a date I get a javascript error (IE8) that’s in the title of the post. I haven’t tested it on other browsers as I am in work at the moment, but I need this working on IE8.
An example of the code that throws this error can be found at http://jsbin.com/uzewi4/10
I’m not very good at javascript, but I’m assuming simplemodal is destroying or doing something weird when you close the modal, which causes the datepicker to break. Any ideas how I can fix this?
It’s SimpleModal. From the docs:
So it’s cloning the elements, and then replacing them with clones. Clearly
DatePickerisn’t expecting that to happen (understandably).Very odd behavior, but adding
persist: truemakes your example work:http://jsbin.com/uzewi4/11
Off-topic: FWIW, jQuery UI itself has a perfectly nice dialog mechanism, including modality…