I have a jQuery.dialog who show a form.
The first input is and I init the datepicker like this
jQue
$('.datepicker').blur();
this would just trigger the blur function just like a use would, therefore the datepicker would hide .
The problem could be because you have set focus on document load somewhere on your script to the first element. so either try and remove that option, or add the above line on document load :)