How to get div text also with it's input's values
<p>I was wondering how to obtain the text inside a given div, with also the input's values as text.</p>

<pre><code>&lt;div id="example"&gt;This is a &lt;input type="text" value="right"/&gt; test.&lt;/div&gt;
</code></pre>

<p>If I just try to get text like this with jQuery :</p>

<pre><code>$("#example").text();
</code></pre>

<p>The result would be <code>This is a test.</code> and I'd want : <code>This is a right test.</code>
The number of input would be unknow. As well as the order of the elements...</p>

<p>EDIT : 
I finally resolved my own problem :</p>

<pre><code>var finalText="";
   $("#example").contents().filter(function() {
        if(this.nodeType==3){ finalText =finalText+ this.nodeValue;}
        else if(this.nodeName=="INPUT"){ finalText=finalText+this.value;}
           return finalText
    })  
</code></pre>

<p><a href="http://jsfiddle.net/jDdXG/" rel="nofollow">The living example</a></p>

<p>But <a href="http://stackoverflow.com/questions/7826685/how-to-get-div-text-also-with-its-inputs-values/7826758#7826758">@Jonathan Lonowski answer</a> is more clear and simpler than mine !</p>
