enforce a no spacebar when filling up input form
<p>I have an input form for username, but I wish to not let the user to add space OR press spacebar when adding a username, how to do that in jquery, I mean, how to add such validation in my current code ?</p>

<pre><code> if(document.getElementById("cvusername")!== null &amp;&amp; (cvusername == "" || cvusername.length &lt; 5 || cvusername.length &gt; 30)){
    alert("-username is required\n-should not be less than 5 characters\n and not greater than 30 characters");
    return false;
 }
</code></pre>
