title: Jquery function that would return html() of passed div?
body: <p>I have tried a couple of ways of doing this but didn't do well. I have a div in my HTML skeleton declared as ("myDiv"). I would like to write a function that would take any passed div as its argument and then return the passed div's html(). I can certainly write something like this and get the div text. But if I have a utility function which does nothing but reads the .html() and returns it then that would be great. </p>
  
  <pre><code>var txt = $("#div").html();
  alert(txt);
  </code></pre>
  
  <p>Here is the function code:</p>
  
  <pre><code>$.fn.getDivHTML = function(obj)
  {
     var txt = $(obj.html());
     return txt;
  }
  </code></pre>
  
  <p>And I am calling the function like this:</p>
  
  <pre><code>$(document).ready(function()
  {
     var val = $.fn.getHTML("#myDiv");
     alert(val);
  });
  </code></pre>
  
  <p>Any help higly be appreciated. Thanks.</p>