To use focus() and datepicker(..) properly with facebox, these need to be added in using the reveal.facebox(…) event AND use the #facebox tag as well (facebox does a copy of the content to put in it’s popup window and you can’t have two boxes focused at the same time now can we?!)
$(function() { $(document).bind('reveal.facebox', function() { $('#facebox #new_date').datepicker({dateFormat: 'dd/mm/yy'}); $('#facebox #new_date').focus(); }); });
Thanks goes to http://groups.google.com/group/facebox/msg/aea0ba1522bf13a3 for this trick! 🙂