Only use first word using .text()
<p>I have a subnav which I am using the text in the subnav to reference a class of the DIV element.</p>

<p>some of the subnav text has spaces so for the ones that have spaces I just want to use the first word only to reference the class of the DIV element. </p>

<p>SCRIPT</p>

<pre><code>$('li.' + $(this).text( function () {

if space

   take first letter only.toggle(true);

if no space

   do nothing.toggle(true);

});
</code></pre>

<p>HTML</p>

<pre><code>&lt;ul&gt;
&lt;li&gt;all&lt;/li&gt;
&lt;li&gt;men&lt;/li&gt;
&lt;li&gt;women&lt;/li&gt;
&lt;li&gt;sun protective clothing&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="men"&gt;&lt;/div&gt;
&lt;div class="women"&gt;&lt;/div&gt;
&lt;div class="sun"&gt;&lt;/div&gt;
</code></pre>

<p>Thanks in advance!</p>
