jQueryUI Ticket 8434

Attempting to reproduce jQueryUI ticket 8434 without ASP.NET

HTML

<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css">
<div id='container'>
<select id='mySel'>
    <option value='Foo'>Foo</option>
    <option value='Bar'>Bar</option>
</select>
<input type='text' id='myText' />
</div>

JavaScript

$(document).ready(function()
                  {
                      $('#myText').datepicker({ changeYear: true, showButtonPanel: true, yearRange: '-2:+2' });
                      
                      $('#mySel').focusout(function()
                                           {
                                               setTimeout(function()
                                                          {
                                                              $('#myText').remove();
                                                          }, 100);
                                               
                                               $('#container').append("<input type='text' id='myText' />");
                                           });
                  });