How to make dynamic data draggable after loading from server

How to make dynamic data draggable after loading from server

Hello,

I'm rather a beginner using jQuery. It's fun but I need some help ...

I'm not sure how to make something draggable which is dynamically loaded. The click event works fine on the new content though.

Like for example:

  1. $('.file').live('click', function() {
  2.       alert('clicked');
  3. });
  4.       
  5. // Load new content after click
  6. $('.icon').live('click', function() {
  7.       var fileId = $(this).attr('id');
  8.       $.post("/get_content/", {'file_id' : fileId}, 
  9.             function(data) {
  10.                   $.each(data, function(i,data){
  11.                         $("#fileDialog").append(<div class="file">data</div>);
  12.                  );
  13.       }, "json");
  14.       
  15.       $('.file').draggable();

  16. });

This doesn't work :-(  The click event does work on the new content, but the new files aren't draggable.

Can somebody help me out plz ...

Thx! :-)

Christophe