How adding <input> in each <td> in datepicker by clicking

How adding <input> in each <td> in datepicker by clicking

Hello.
How can I realize the following: 
I want by clicking on the  <td></td> with  'date',  <input> with value =
'date'  was inserted between <td></td>?
Its possible with datepicker UI?

How I have this:
  1. <div id="datepicker"></div>
  2. <input id="input">

  
  1. <script type = "text/javascript">
  2. $(function() {
  3. $("#datepicker").datepicker({dateFormat: 'mm/dd/yy', altField: '#input'});
  4. $("#datepicker").change(function() {
  5. var date = $(this).datepicker("getDate");
  6. $("#input").attr('value', date);
  7. });
  8. });

  9. </script>