getting text from selective nodes in javascript
<p>From below HTML code I want to get all the text except that in 'text_exposed_hide' span elements.</p>

<p>Initially I tried to get the text from span with no class names.
But this method misses the text which is not within any span but just in div.</p>

<p>How can I get the required text. I need this code in pure javascript</p>

<pre><code>&lt;div id="id_4f1664f84649d2c59795040" class="text_exposed_root"&gt;
9jfasiklfsa
  &lt;span&gt;CT:PFOUXHAOfuAI07mvPC/&lt;/span&gt;
  &lt;span&gt;NAg==$1ZUlmHC15dwJX8JNEzKxNDGGT&lt;/span&gt;
  dwL/L1ubjTndn89JL+M6z
  &lt;span class="text_exposed_hide"&gt;...&lt;/span&gt;
  &lt;span class="text_exposed_show"&gt;
    &lt;span&gt;MDmclkBPI/&lt;/span&gt;
    &lt;span&gt;s4B7R9hJyU9bE7zT10xkJ8vxIpo0quQ&lt;/span&gt;
    55
  &lt;/span&gt;
  &lt;span class="text_exposed_hide"&gt;
    &lt;span class="text_exposed_link"&gt;
      &lt;a onclick="CSS.addClass($("id_4f1664f84649d2c59795040"), "text_exposed");"&gt;See More&lt;/a&gt;
    &lt;/span&gt;
  &lt;/span&gt;
&lt;/div
</code></pre>

<p>Edit :</p>

<p>I tried removing nodes with class name 'text_exposed_hidden' and then getting text from remaining nodes. Below is the code. But its not working
Control is not entering for loop. Even visibleDiv.removeChild(textExposedHideNodes[0]) is not working. I am running this in Chrome Browser 16.0</p>

<pre><code>    //msg is the parent node for the div
    visibleDiv = msg.getElementsByClassName("text_exposed_root");

    textExposedHideNodes = visibleDiv.getElementsByClassName("text_exposed_hide");
    for(var n = 0;n &lt; textExposedHideNodes.legth ; n++ ) { 
        console.log("Removing");
        msg.removeChild(textExposedHideNodes[n]);
    }

    return visibleDiv.innerText;
</code></pre>
