How to get count of word in element using javascript?
<p>Hi I would like to do a Word Count in my RTE (Rich Text Editor) with javascript can also use with jquery. But it should not count the html tags and repeating white spaces.</p>

<p>Sample Text:</p>

<p><code>&lt;h1&gt;Hello World&lt;/h1&gt; &lt;p&gt; This  is   Good!!!&lt;/p&gt; answer &lt;h2&gt;thanks! &lt;/h2&gt;</code></p>

<p>The javascript should display 7 only.</p>

<p>Is there any javascript code for this and that is also fast to calculate the Word Count?</p>

<p>Thanks!</p>

<p><strong>EDIT</strong></p>

<p>What if the sample text is this: <code>&lt;p&gt;11 22&amp;nbsp; 33&lt;/p&gt;&lt;p&gt;44&lt;/p&gt;5&lt;br&gt;&lt;/div&gt;</code>
The javascript should display 5 only.</p>