tags:

views:

105

answers:

1

Hi all, In the function given below i am sending a harcode value in droppable function i.e tag. I want to find out on which element this file (.File_div) has been dragged so that i can pass that value in the tag variable.How can I do this?

function dropFile()
{
     $(".File_div").draggable({
         helper:'clone',
         revert: 'invalid'
     });
     var tag="#Normal_Tag1_div_dummy1";
     $(tag).droppable({
      drop: function(ev,ui) { alert('dropped');
          //accept: ".File_div"
          var dropped = ui.draggable;
          alert(dropped);
          var file_img_src=document.getElementById('file_img').src;
          var image='<img id="file_img'+count+'" class ="file_img" name="file_img" src='+file_img_src+" />"
          $(image).appendTo(this).dblclick(
              function(event){
                        alert("1");
                        window.event.cancelBubble = true;
                         //var jsmarty=WMCreateSmartyObject();
                        //var test_tpl= WMSmartyFetch(jsmarty, 'dialog.tpl');
                        //document.getElementById('test').innerHTML=test_tpl;
                        //dialogtest();
                        $("#dialog1").dialog(
                       {
                           buttons:
                                    {
                                        "Upload file": function(){
                                        },
                                        Cancel: function() {
                                        $(this).dialog('close');
                                        }
                                    },
                            close: function() {
                                $('#dialog1').dialog('destroy');
                            }
                        });
                        alert("2");
           });

     }

    });

   count++;

}
A: 

You are doing it correctly.

var dropped = ui.draggable;
alert( dropped.attr('id')); if it has an id

dropped will be your jQuery object that you released.

Elzo Valugi