Anyone know how to remove white space between strings for all browsers? This works in everything but IE7. Basically all the li’s text is used to reference div’s class to show them. Some li’s text has spaces some do not.
SCRIPT
$('li.' + $(this).text().replace(/ /g, "-")).toggle(true);
HTML
<ul>
<li class="button" id="sun">sun protective clothing</li>
<li class="button" id="lawn">lawn games</li>
<li class="button" id="stuff">stuff</li>
</ul>
<div class="sun-protective-clothing"></div>
<div class="lawn-games"></div>
<div class="stuff"></div>
Thanks in advance!
You can use the unicode equivalent of
 =u00a0Now works great in IE7 too! 🙂
example DEMO