What's Here?
- Members: 244,177
- Replies: 692,922
- Topics: 113,122
- Snippets: 3,863
- Tutorials: 935
- Total Online: 1,345
- Members: 89
- Guests: 1,256
|
Function checks for white space from a form field.
|
Submitted By: skyhawk133
|
|
Rating:
|
|
Views: 22,215 |
Language: JavaScript
|
|
Last Modified: February 28, 2005 |
Instructions: Call using hasWhiteSpace(form.field.value);
Returns boolean. |
Snippet
function hasWhiteSpace(s)
{
reWhiteSpace = new RegExp(/^\s+$/);
// Check for white space
if (reWhiteSpace.test(s)) {
alert("Please Check Your Fields For Spaces");
return false;
}
return true;
}
Copy & Paste
|
|
|
Be Social
Programming
Web Development
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|