How to remove spaces using JavaScript? : <p>how to remove spaces.
i use onkeyup to show output in div</p>

<p>Thanks</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var inputBox = document.getElementById('chatinput');

inputBox.onkeyup = function() {
  document.getElementById('printchatbox').innerHTML = inputBox.value;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;div class="form-group"&gt;
  &lt;label&gt;Title Page&lt;/label&gt;
  &lt;input type="text" id="chatinput" class="form-control" required=""&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
  &lt;div&gt;&lt;b&gt;Permalink: &lt;/b&gt;http://doamin.com/&lt;span id="printchatbox" class="cl-blue"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</code></pre>
</div>
</div>
</p>
