Click here to Skip to main content
16,004,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
if (txtSSAETitle.value.replace(/^\s+|\s+$/, '').length < 1) {
                txtSSAETitle.focus();
                 alert("AE title should not be blank.");
                 return false;
            }
              txtSSAETitle.value.trim(); 
           if (txtSSAETitle.value.length > 16) {                     
txtSSAETitle.focus();
               alert("AE title should not exceed 16 characters.");
               return false;
           }




when i enter spaces in txtSSAETitle it also checks length for spaces...
even i trim the txtSSAETitlvalue..
Posted
Updated 15-Apr-12 22:07pm
v2
Comments
CRDave1988 16-Apr-12 2:52am    
r u using jQuery? because i m not aware with any in built trim function in java script.
[no name] 16-Apr-12 3:04am    
i am using javascript

1 solution

Try This

JavaScript
var str=txtSSAETitle.value.trim();
if (str.length > 16)
{
    txtSSAETitle.focus();
    alert("AE title should not exceed 16 characters.");
    return false;
}


Tell me what happen
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900