What's Here?
- Members: 149,621
- Replies: 506,752
- Topics: 79,851
- Snippets: 2,666
- Tutorials: 706
- Total Online: 1,930
- Members: 67
- Guests: 1,863
|
Function checks for white space from a form field.
|
Submitted By: skyhawk133
|
|
Rating:
|
|
Views: 16,824 |
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
|