title: remove spaces in string using javascript
body: <p>I need to do some functions on some text field contents before submitting the form, like checking the validity of the customer registeration code, having the customer name as his code in customers table appending an incrementing number.</p>
  
  <p>I don't want to do it after the form is submitted becuase I need it to be displayed in the code field before submitting the form.</p>
  
  <p>My code:</p>
  
  <pre><code>function getCode(){
      var temp = document.getElementById("temp").value ;
      var d = parseInt(document.getElementById("temp").value) + 1;
      document.getElementById("customernumber").value = d;
      document.getElementById("code").value = document.getElementById("name").value+"-"+ d;
  }
  </code></pre>
  
  <p>It all works fine, but the last line of code developed the code WITH the spaces between the code.</p>