Replace all spaces in a string with '+'
$("#topNav" + $("#breadCrumb2nd").text().replace(" ", "")).addClass("current");
You have to tell replace() to repeat the regex:
If you want to match all whitespace, and not just the literal space character, use
\s as well: