Mouse position relative to div
<p>I am using jquery ui for drag and drop. I am trying to get mouse position relative to div, here is my code:</p>

<pre><code>$( "#db_tables " ).droppable({
  activeClass: "ui-state-default",
  hoverClass: "ui-state-hover",
  drop: function( event, ui ) {
    var x = ui.position.left - ui.offset.left; // tired event.pageX - this.offsetLeft;
    var y = ui.position.top - ui.offset.top; // tired event.pageY - this.offsetTop;
    $( '&lt;div style="margin-top:' + y   + 'px; margin-left:' + x   + 'px; "&gt;&lt;/div&gt;' ).html( ui.draggable.html() ).appendTo( this );
  }
});
</code></pre>

<p>But the position of dropped div is not correct, Can anybody please tell me what is wrong with code?</p>
