checking space between text in javascript
<p>I want to check the gap between two or more words, i have given as an input, in a text box. If there had any space, then i want to alert user that no space is allowing. I can check the existence of text simply using "if else" statement. But can't do the desired stuff in this way. My code is given below :</p>

<pre><code>&lt;script type="text/javascript"&gt;

function checkForm()

    {

        var cName=document.getElementById("cName").value;
        var cEmail=document.getElementById("cEmail").value;

        if(cName.length&lt;1)

        {
            alert("Please enter both informations");
            return false;
        }

        if(cEmail.length&lt;1)
        {
            alert("Please enter your email");
            return false;
        }

        else
        {
            return true;
        }

    }
</code></pre>

<p>
            </p>

<pre><code>        Name : &lt;input type="text" id="cName" name="cName"/&gt;
        &lt;br/&gt;
        &lt;br/&gt;
        Email : &lt;input type="text" id="cEmail" name="cEmail"/&gt;
        &lt;br/&gt;
        &lt;br/&gt;
        &lt;input type="submit" value="Go!"/&gt;

        &lt;/form&gt;
</code></pre>

<p>
</p>

<ul>
<li>Thankyou</li>
</ul>
