title: Escape a white space character using Javascript
body: <p>I have the following jquery statement. I wish to remove the whitespace as shown below. So if I have a word like:</p>
  
  <p><strong>For example</strong> <br /></p>
  
  <ul>
  <li><code>#Operating/System</code> I would like the
  end result to show me
  <code>#Operating\/System</code>. (ie with a
  escape sequence).</li>
  </ul>
  
  <p><br /></p>
  
  <ul>
  <li>But if I have <code>#Operating/System test</code> then I want to show
  <code>#Operating\/System</code> + escape
  sequence for space. The <code>.replace(/ /,'')</code>
  part is incorrect but <code>.replace("/","\\/")</code> works
  well as per my requirements.</li>
  </ul>
  
  <p>Please help!</p>
  
  <pre><code>$("#word" + lbl.eq(i).text().replace("/","\\/").replace(/ /,'')).hide();
  </code></pre>