title: Need to trim all the elements in the form using javascript
body: <p>I need to trim all the trailing white spaces from the text elements of the form. I need to do it in minimal number of steps. As soon as i press onsubmit, it should trim all the white spaces and then perform the further operations. Is there any script available? If not then can you please help me to achieve my Goal. Currently i need to manual identify each element and then perform a trim like. </p>
  
  <pre><code>var username = myform.elements['username'].value;
  username.trim();
  </code></pre>
  
  <p>How to generalize it?</p>