What is the correct way to deal with texts outside the tag?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/298750/how-do-i-select-text-nodes-with-jquery">How do I select text nodes with jQuery?</a>  </p>
</blockquote>



<p>What is the correct way to deal with texts outside the tags</p>

<p>I tried all the methods, but all failed</p>

<p>And I experimented with this</p>

<pre><code> &lt;script&gt;

  $(function(){
  var A = $(".A").text();
  var B = $(".B").text();
  var C = $(".C").text();
  var D = $(".D").text();
  $("#BD").text(A+B+C+D);
      });

  &lt;/script&gt;

  &lt;body&gt;

   &lt;div&gt;
    &lt;span class="A"&gt;&lt;/span&gt;6
    &lt;span class="B"&gt;&lt;/span&gt;8
    &lt;span class="C"&gt;&lt;/span&gt;3
    &lt;span class="D"&gt;&lt;/span&gt;9
  &lt;/div&gt;

  &lt;div id="BD"&gt;&lt;/div&gt;
  &lt;/body&gt;
</code></pre>

<p>As well as this</p>

<pre><code>&lt;script&gt;

$(function(){
 var A = $(".A").text();
 var B = $(".B").text();
 var C = $(".C").text();
 var D = $(".D").text();
  alert(A+B+C+D);
});

 &lt;/script&gt;
</code></pre>

<p>But they all didn't work</p>

<p>How can I collect the numbers correctly?!</p>
