display div width&height + div x&y coordinates

display div width&height + div x&y coordinates

hi, im new to JQuery, i found 2 tutorials which i followed ut now im a bit stuck.

I have x amount of draggable & resizable divs, they work as i want them to, im outputing the coordinates of each div in a textfield. My problem is that the textfield only displays coordinates when a div is CLICKED, so when holding the mouseBtn and draging a div  around then releasing the mouseBtn  the coordinates aren't displayed in the textfield. 
I tried to set 'mouseup' instead of 'click' but then the divs are being dragged around all the time even tho you released the mouseBtn.

The second thing is that i want to output the size of the div in another textfield, so when a div is resized the new size of that div should be displayed in the textfield.





  1. <script>

  2. $('#resizeDiv, #resizeDiv2, ,#resizeDiv3')
  3.   .draggable()
  4.   .resizable({
  5. minHeight: 150,
  6. minWidth: 200
  7. });

  8. </script>

  9. <script>
  10. $("*", document.body).click(function (e) {
  11.   var offset = $(this).offset();
  12.   e.stopPropagation();
  13.   $("#result").text(this.id + " coords ( " + offset.left + ", " +
  14.                                   offset.top + " )");
  15. });
  16. </script>
for the size i tried to work with

  1.   function showWidth(ele, w) {
  2.       $("div").text("The width for the " + ele + 
  3.                     " is " + w + "px.");
  4.     }

  5.   $('#test').click(function () { 
  6.       showWidth("paragraph", $(this).width()); 
  7.     });

i want to send both size and x&y of each div to a database, so any suggestions that will improve/help my process are very much welcome!

Greets