Creating a draggable div using jquery

Creating a draggable div using jquery

Sorry, really new at this.  So I used the jQuery UI to create a draggable div, like so:

  1. <div id="draggable" class="ui-widget-content">
  2.   <p>Drag me around</p>
  3. </div>
I've also implemented the jQuery UI button, and I want the button, when clicked, to create a duplicate div, like so:

  1.   $(function() {
  2.     $( "input[type=submit], a, button" )
  3.       .button()
  4.       .click(function( ) {
  5.         $( "<div id='draggable' class='ui-widget-content'><p>Drag me around</p></div>" ).appendTo( "body" );
  6.       });
  7.   });
It creates the div like I want, however it's not draggable.  When I inspect the element, the original div has a  bunch of other properties like " ui-widget-content ui-draggable ui-draggable-handle". Does anyone know why that is? And what can I do to get the new div to behave like the original?