I\'m trying to check if a string has white space. I found this function but it doesn\'t seem to be working:
function hasWhiteSpace(s)
{
Your regex won't match anything, as it is. You definitely need to remove the quotes -- the "/" characters are sufficient.
/^\s+$/ is checking whether the string is ALL whitespace:
^ matches the start of the string.\s+ means at least 1, possibly more, spaces.$ matches the end of the string.Try replacing the regex with /\s/ (and no quotes)