title: How to Get text from element, excluding some other elements inside that
body: <p>I'm using <code>domCrawler</code> in symfony framework. I crawled contents from html using it. Now I need to get the text inside an element with ID. I'm able to fecth the text by using the code below:</p>
  
  <pre><code>$nodeValues = $crawler1-&gt;filter('#idOfTheElement')-&gt;each(function (Crawler $node, $i) {
              return $node-&gt;text();
          });
  </code></pre>
  
  <p>The element(<code>#idOfTheElement</code>) contains some spans, buttons etc (those having some classes also). I don't want the contents inside those. How to Get text from element, excluding some other elements inside that.</p>
  
  <p>Note: The text I wanted to fetch, does not have any other wrapper, other than the element #idOfTheElement</p>
  
  <p>The Html is look like below:</p>
  
  <pre><code>&lt;li id='#idOfTheElement'&gt;Tel :&lt;button data-pjtooltip="{dtanchor:'tooltipOpposeMkt'}" class="noMkt JS_PJ" type="button"&gt;text :&lt;/button&gt;&lt;dl&gt;&lt;dt&gt;&lt;a name="tooltipOpposeMkt"&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;div class="wrapper"&gt;&lt;p&gt;&lt;strong&gt;Signification des pictogrammes&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Devant un numéro, le picto &lt;img width="11" height="9" alt="" src="something"&gt; signale une opposition aux opérations de marketing direct.&lt;/p&gt;&lt;span class="arrow"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/dd&gt;&lt;/dl&gt;12 23 45 88 99&lt;/li&gt;
  </code></pre>