I am using the following in my application
- DatePicker from jQuery UI
- Pretty Photo.
When I press some link a PrettyPhoto popup opens with a input field which should trigger the DatePicker.
I managed to make the DatePicker work correctly with this piece of code:
$(function(){
$('#date_pp').live('click',function (){
$(this).datepicker('destroy').datepicker().focus();
});
});
Now everything work just fine in all browsers except Internet Explorer.
I’m just guessing that IE has some problem with the .live() method because it fails to run even a dummy alert message. Weirdly enough the jQuery examples from their official website work.
Over here I red something about this issue and tried their method. This doesn’t work either.
I managed to find the problem.
Following the jQuery tutorial I placed the datepicker js code in the same file with the field which triggers the datepicker. This file was dynamically inserted in the DOM with PrettyPhoto.
I removed this code from the file above mentioned and rewrote it in a separate
.jsfile. Then I simply declared the code in the parent document’s (the in which all this happens) header:Now everything works just fine in all browsers including IE