How to write javaScript function for this?
<p>I have a textbox and i write javascript function that if it is blank then it will generate alertbox .
but i press space in that textbox then it doesnot generate alertbox.</p>

<p>so i want that if i give space then it also generate alertbox, for this what to do?</p>

<p>I used this function:</p>

<pre><code>function Trim(objValue) {
    var lRegExp = /^\s+/;
    var rRegExp = /\s+$/;
    objValue = objValue.replace(lRegExp, ''); //Perform LTRim
    objValue = objValue.replace(rRegExp, ''); //perform RTrim
    return objValue;
}
function ValidateTextBoxIncome() {
    var txtEnterItems = document.getElementById("txtEnterItems");
 if (Trim(txtEnterItems) == '') {
        alert("Cannot be blank");
        return false;
    }
}
</code></pre>

<p>where is the error? please suggest me.</p>
