How to get the HTML of a div, including value of inputs
<p>Say I have this div:</p>

<pre><code>&lt;div id='myDiv'&gt;
  &lt;input type='text' id='foo' size='30' /&gt;
&lt;/div&gt;
</code></pre>

<p>and i run this javascript code:</p>

<pre><code>($("#foo").val('bar');
</code></pre>

<p>If I then do:</p>

<pre><code>alert($("#myDiv").html());
</code></pre>

<p>or </p>

<pre><code>alert(document.getElementById('myDiv').innerHTML);
</code></pre>

<p>I get only the original copy of the html where the value of <code>foo</code> textbox is still blank. I would like to get a current copy of the html with a <code>value='bar'</code> attribute added to foo's html code.</p>

<p>How can this be done?</p>
