Regular expression for not allowing spaces in the input field
Solution 1:
While you have specified the start anchor and the first letter, you have not done anything for the rest of the string. You seem to want repetition of that character class until the end of the string:
var regexp = /^\S*$/; // a string consisting only of non-whitespaces
Solution 2:
Use +
plus sign (Match one or more of the previous items),
var regexp = /^\S+$/