How to get number of html elements in a string?
<p>How to get number of HTML elements (HTML tags) in a string?</p>

<p>For example I have this string: </p>

<pre><code>&lt;div&gt; some text
     &lt;div&gt;
           &lt;label&gt;some text&lt;/label&gt;
     &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Now how would I find number of html tags in this string? The result in the case above will be 3.</p>

<p>I did tried this, thought it will work but it didn't:</p>

<pre><code>$('*').length;
</code></pre>
